实时检测路由是否发生改变 watch: { '$route': { handler(to, from){ console.log(to,from) }, deep: true, // 深度监听 immediate: true, // 第一次初始化渲染就可以监听到 } }