Vue系列 => [BUG] 面包屑导航切换到首页侧导航栏激活问题

it2026-08-15  8

vue监听$route变化,报错:

Error in callback for watcher “$route”: “TypeError: Cannot read property ‘call’ of undefined”

watch: { // 如果路由有变化,会再次执行该方法 $route: function(newV) { console.log(newV) if (newV.path == '/welcome') { this.activeStatus = '' } } }

解决方法

检查函数function是否在method下面

newV.path == '/welcome'
最新回复(0)