watch:{ $route(to,from){ console.log(to.path); } }
watch: { '$route':'getPath' }, methods: { getPath(){ console.log(this.$route.path); } }
watch: { $route: { handler: function(val, oldVal){ console.log(val); }, // 深度觀察監聽 deep: true } }
watch:{ $route(to,from){ console.log(to.path); } }
watch: { '$route':'getPath' }, methods: { getPath(){ console.log(this.$route.path); } }
watch: { $route: { handler: function(val, oldVal){ console.log(val); }, // 深度觀察監聽 deep: true } }