vue-watch报错[[Vue warn]: Method “watch“ has type “object“ in the component definition. Did you refer]

简介: [Vue warn]: Method “watch” has type “object” in the component definition. Did you reference the function correctly?

1.F12查看浏览器报错

image.png检查前端编码,暂没有发现任何问题,也可以正常编译,后端也无报错。

2.找到前端代码,查看watch所在位置

发现问题所在!watch方法竟然写进去了methods方法里面,被methods方法包裹住了。

只需要把watch代码块拿出来即可

3.解决方案

调整watch的位置即可

image.png

更改之后刷新页面发现就没有这个报错了

image.png

相关文章
|
17天前
|
JSON 数据格式 Python
【python】解决json.dump(字典)时报错Object of type ‘float32‘ is not JSON serializable
在使用json.dump时遇到的“Object of type ‘float32’ is not JSON serializable”错误的方法,通过自定义一个JSON编码器类来处理NumPy类型的数据。
18 1
|
21天前
|
并行计算 Serverless API
函数计算操作报错合集之出现 "AttributeError: 'NoneType' object has no attribute 'pop'" 错误,是什么原因
在使用函数计算服务(如阿里云函数计算)时,用户可能会遇到多种错误场景。以下是一些常见的操作报错及其可能的原因和解决方法,包括但不限于:1. 函数部署失败、2. 函数执行超时、3. 资源不足错误、4. 权限与访问错误、5. 依赖问题、6. 网络配置错误、7. 触发器配置错误、8. 日志与监控问题。
|
1月前
|
JavaScript 索引
Component name “index“ should always be multi-word vue/multi-word-component-names
Component name “index“ should always be multi-word vue/multi-word-component-names
|
1月前
|
Python
【Python】已解决:(Python xlwt写入Excel报错)AttributeError: ‘function’ object has no attribute ‘font’
【Python】已解决:(Python xlwt写入Excel报错)AttributeError: ‘function’ object has no attribute ‘font’
17 0
|
1月前
|
Python
【Python】已解决:(Python写入Excel表格报错)‘NoneType’ object has no attribute ‘write’
【Python】已解决:(Python写入Excel表格报错)‘NoneType’ object has no attribute ‘write’
44 0
|
1月前
|
JSON 前端开发 数据格式
【Python】已解决:TypeError: Object of type JpegImageFile is not JSON serializable
【Python】已解决:TypeError: Object of type JpegImageFile is not JSON serializable
36 0
|
2月前
|
JavaScript
error Component name “Login“ should always be multi-word vue/multi-word-component-names【已解决】
error Component name “Login“ should always be multi-word vue/multi-word-component-names【已解决】
63 1
|
1月前
|
JavaScript
vue 动态组件【详解】component :is
vue 动态组件【详解】component :is
99 0
|
2月前
|
消息中间件 监控 Serverless
函数计算操作报错合集之显示报错:RecursionError: maximum recursion depth exceeded while calling a Python object,该如何解决
在使用函数计算服务(如阿里云函数计算)时,用户可能会遇到多种错误场景。以下是一些常见的操作报错及其可能的原因和解决方法,包括但不限于:1. 函数部署失败、2. 函数执行超时、3. 资源不足错误、4. 权限与访问错误、5. 依赖问题、6. 网络配置错误、7. 触发器配置错误、8. 日志与监控问题。
|
3月前
|
JavaScript
Vue : Object.defineProperty()
Vue : Object.defineProperty()
33 2