admin管理员组文章数量:1403527
I'm using the newest [email protected] with Composition API. I want to use current [email protected] accordingly to their documentation. But when handleSubmit
is used nothing works as I expect.
<form @submit="onSubmit">
<div class="mb-3">
<label for="edit-email" class="form-label">E-mail</label>
<input
id="edit-email"
name="email"
class="form-control"
v-model="email"
type="text"
/>
<div class="invalid-feedback">{{ emailError }}</div>
</div>
<button class="btn btn-primary" type="submit">Save</button>
</form>
import { useField, useForm } from "vee-validate";
import { object, string } from "yup";
export default {
name: "App",
setup() {
const { handleSubmit } = useForm();
const onSubmit = handleSubmit((values) => {
console.log(values, submitCount.value); // values is empty: {}
});
const schema = object({
email: string().required().email(),
});
useForm({
validationSchema: schema,
initialValues: {
email: "",
},
});
const { value: email, errorMessage: emailError } = useField("email");
return {
email,
emailError,
onSubmit,
};
},
};
Reproduced problem:
本文标签: javascriptvue3veevalidatehandleSubmit doesn39t return valuesStack Overflow
版权声明:本文标题:javascript - vue3 + vee-validate - handleSubmit doesn't return values - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744394422a2604144.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论