Vue中使用【watch检测路由】的方法

this.$router.push({path:'/indexs'});   //实现点击事件的路由跳转

watch:{

$route(val){
if(this.$route.path=="/shop" || this.$route.path=="/mine"){
this.bool=false;
}else if(this.$route.path=="/indexs"){
this.bool=true;
}
}
},

《敢想敢做,就敢于去实现它》 -----我的座右铭
原文地址:https://www.cnblogs.com/chenhongshuang/p/8796473.html