原文地址:https://www.cnblogs.com/gaoyafeng/archive/2019/05/20/10896791.html
背景:在学习梁灏大佬的《vue.js实战》时,标签页组件实例遇到的
报错: Method "watch" has type "object" in the component definition. Did you reference the function Method "watch" has type "object" in the component definition. Did you reference the function correctly?
原因: watch 是一个对象,应该以键值对的形式来使用,但是我 将 watch 放到了 methods: {} 中,导致了这个问题;
解决办法: 将watch 对象 拿出来,与 methods 平级