Siz*_*ode 4 vue.js vuejs2 vue-storefront
目前我在Product.vue文件中有以下手表
watch: {
isOnline: {
async handler (isOnline) {
if (isOnline) {
const maxQuantity = await this.getQuantity();
this.maxQuantity = maxQuantity;
}
}
},
isMicrocartOpen: {
async handler (isOpen) {
if (isOpen) {
const maxQuantity = await this.getQuantity();
this.maxQuantity = maxQuantity;
}
},
immediate: true
},
isSample (curr, old) {
if (curr !== old) {
if (!curr) {
console.log('send the updateCall', curr);
// this.updateProductQty(this.product.qty);
pullCartSync(this);
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
但我在控制台中收到以下错误(Vue Warn)
[Vue 警告]:方法“watch”在组件定义中具有“object”类型。您是否正确引用了该函数?
我不确定为什么我会收到这个错误,因为我使用的语法似乎是正确的,它甚至可以正常运行。
任何建议为什么它在错误控制台中发出此警告?
更新:
我在 vue 页面中使用手表的位置。