vue监听路由变化
作者:互联网
1、
watch:{ $route(to,from){ console.log(to.path); } },
2、
watch: { $route: { handler: function(val, oldVal){ console.log(val); }, // 深度观察监听 deep: true } },
3、
watch: { '$route':'getPath' }, methods: { getPath(){ console.log(this.$route.path); } }
标签:vue,console,log,val,route,watch,getPath,监听,路由 来源: https://www.cnblogs.com/hellowoeld/p/15018465.html