vue路由变化监听
watch:{ $route(to,from){
// to.path这个为路径
if(to.path=="home"){
this.$store.dispatch("aa");//aa为方法名
}
alert("路由change"); } }
相关文章
watch:{ $route(to,from){
// to.path这个为路径
if(to.path=="home"){
this.$store.dispatch("aa");//aa为方法名
}
alert("路由change"); } }