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;
}
}
},

posted @ 2018-04-11 16:22  莫忘初衷双  阅读(1204)  评论(0编辑  收藏  举报