Это мой объект данных:
registration: {
step1: {
project: '',
},
step2: {
adres: '',
facade: '',
floor: '',
},
},
Я пытаюсь проверить вводимые пользователем данные с помощью одной функции для каждого шага, например:
validateStep(stepNumber) {
const self = this;
const step = step${stepNumber};
console.log(step);
this.$v.registration[${step}].touch();
if (this.$v.registration[${step}].$error) {
this.$q.notify('Controleer aub de velden opnieuw');
return;
}
self.$refs.stepper.next();
}
Но это выдает эту ошибку:
TypeError: this. $ V.registration ["". Concat (...)]. Touch не является
функция
Я тоже так пробовал:
validateStep(stepNumber) {
const self = this;
const step = `step${stepNumber}`;
console.log(this.$v.registration[step]); //this prints the correct object
const currentStep = this.$v.registration[step];
currentStep.touch();
if (currentStep.$error) {
this.$q.notify('Controleer aub de velden opnieuw');
return;
}
self.$refs.stepper.next();
},
Что я делаю не так?