Я хочу, чтобы созданные компоненты включали VeeValidate. Шаблон должен быть сгенерирован рендером. Если введенный текст не проверен, я надеюсь, что props.errors
сможет перехватить сообщение проверки и показать его. Но props.errors.length
всегда равно 0. Я пропустил какое-то событие?
Версия фреймворка:
Vue 2.6.11
VeeValidate 2.3.5
Вот мой код:
Vue.component('textbox', {
props: {
value: {
type: String
},
header: {
type: String
}
},
render: function(createElement, context) {
let self = this;
return createElement('validation-provider', {
attrs: {
name: self.header,
rules: "required|email"
},
scopedSlots: {
default: function(props) {
const children = [];
children.push(createElement('input', {
attrs: {
type: 'text',
name: "foo",
value: self.value
},
on: {
input: function(event) {
self.$emit('input', event.target.value);
}
}
}));
console.log(props.errors.length);
return children;
}
}
})
}
});