vue 中使用 watch 出现了如下的报错

报错: 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 平级;

 

相关文章:

  • 2022-12-23
  • 2021-11-10
  • 2022-12-23
  • 2021-10-10
  • 2021-06-28
猜你喜欢
  • 2022-12-23
  • 2021-12-15
  • 2021-06-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-27
相关资源
相似解决方案