Vue-cli watch监听$route失效

使用官网的例子使用无效:

        '$route' (to, from) {
                console.log(to.path); //当前路由
                console.log(from.path); //跳转路由

        }

这是因为在某个路由下所要监听的路由只能是他的子路由,比如你在/a下只能监听/a这个路由的子路由的变化。

猜你喜欢

转载自blog.csdn.net/qq_41337100/article/details/106123287