Подскажите, почему watch не срабатывает? Выдает ошибку : Error in callback for watcher "form": "TypeError: Cannot read property 'call' of undefined"
Необходимо отслеживать изменения в объекте формы, полей много, приведу маленький кусочек.
<b-form-input
id="id-repo-label"
v-model="
form.SPCEX_DOC.document.selection_info.selection_info_rec.finstr
"
size="sm"
plaintext
>
</b-form-input>
data() {
return {
dateFormatOptions: {
year: "numeric",
month: "numeric",
day: "numeric"
},
isDateState: null,
dateConstraints: {
min: minDate,
minRepayDate: minRepayDate
},
form: {
SPCEX_DOC: {
receiver: {
addressee_info: {
name: "СПВБ",
id: 263
}
},
sender: {
addressee_info: {
name: "Комитет финансов СПб",
id: 302
}
},
document: {
ver: "3.03a",
form: "selection_info",
selection_info: {
executor_phone: 78128965423,
selection_info_rec: {
initiator_code: 302,
period: "",
paying_date: today,
booking_time_finish: "16:00",
selection_id: 5628,
min_ord_rate: 198,
total_sum: 31201,
finstr: "SPRA---RS-",
selection_type: "RA",
booking_time_start: "14:04:59",
selection_date: today,
initiator_name: "Комитет финансов СПб",
currency: "RUB",
repaym_date: minRepayDate,
comment: ""
},
records: 1,
executor_name: "executor_name1"
},
remarks: "Объявление об отборе заявок"
},
doc_props: {
delivery_confirmation: "N",
sender_doc_id: "sender_doc_id1",
doc_ver: 750.952,
doc_name: "doc_name1",
doc_date: "2020-03-03",
doc_type: "selection_info",
delivery_mode: "P",
doc_time: "14:04:59"
}
}
},
currency: {
options: [{ value: "RUB", text: "RUB" }]
},
idRepo: {
selected: "SPRA---RS-",
options: [{ value: "SPRA---RS-", text: "SPRA---RS-" }]
},
show: true,
boxTwo: ""
};
}
},
watch: {
// следим за изменением формы
form: {
deep: true,
heandler: function() {
console.log("changed");
}
}
},
[Vue warn]: Error in callback for watcher "form": "TypeError: Cannot read property 'call' of undefined"
Ответы (1 шт):
Автор решения: Nastya
→ Ссылка
UPD
Опечатка в этом месте
heandler: function() {
console.log("changed");
}
должен быть коллбек - handler!