在app.vue中,修改this.$route.meta,watch设置了deep: true,没有监听到变化,页面也没有渲染?
// App.vue中
watch: {
$route: {
deep: true,
handler(to, from) {
console.log(6666666666, to); // 执行modify方法无法打印
}
}
},
methods: {
modify() {
console.log(777777);
this.$route.meta.navName = "修改";
// this.$set(this.$route.meta, "navName", "修改"); // 用这个也无效
},
}
如何才能监听到meta的更新?
手动给 this.$route.meta 添加双向监听