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

相关文章
|
4天前
|
JavaScript 应用服务中间件 nginx
vue项目中页面遇到404报错
vue项目中页面遇到404报错
|
4天前
|
JavaScript
Vue的vant notify组件报错Notify is not defined
Vue的vant notify组件报错Notify is not defined
|
4天前
|
JavaScript
报错[Vue warn]: $listeners is readonly. $attrs is readonly.怎么解决?
报错[Vue warn]: $listeners is readonly. $attrs is readonly.怎么解决?
|
4天前
|
JavaScript
Vue报错\page\ComplianceTraceReport\index.vue{ parser: “babylon“ } is deprecated; we now treat it 怎么解决?
Vue报错\page\ComplianceTraceReport\index.vue{ parser: “babylon“ } is deprecated; we now treat it 怎么解决?
|
4天前
vue3配置路由报错Catch all routes (“*“) must now be defined using a param with a custom regexp.
vue3配置路由报错Catch all routes (“*“) must now be defined using a param with a custom regexp.
60 0
|
4天前
|
JavaScript 内存技术
Vue 安装vue-element-admin启动报错error:0308010C:digital envelope routines::unsupported
Vue 安装vue-element-admin启动报错error:0308010C:digital envelope routines::unsupported
|
4天前
|
JavaScript 算法 Linux
【vue报错】error:0308010C:digital envelope routines::unsupported
【vue报错】error:0308010C:digital envelope routines::unsupported
49 3
|
2天前
|
设计模式 JavaScript 前端开发
Vue3报错Property “xxx“ was accessed during render but is not defined on instance
Vue3报错Property “xxx“ was accessed during render but is not defined on instance
|
4天前
|
JavaScript 前端开发 容器
Vue 3 中 <transition-group> 组件报错的非 props 属性传递问题
Vue 3 中 <transition-group> 组件报错的非 props 属性传递问题
15 1
|
4天前
|
JavaScript 数据处理
vue报错 ‘超出最大堆栈大小‘
vue报错 ‘超出最大堆栈大小‘
11 0