话不多说直接看代码

watch:{
	//监听vuex中userNumber的变化
	'$store.state.userNumber'(val){
		//变化之后根据自己项目需求写自身的逻辑代码,下面只是示例
     	if( !this.isLogin){
       		this.dialogVisibleLogin=val
     	}
	},
	//监听路由变化的写法
	$route(to,from){
		//to要前往的路由,from从那个路由过来
      	console.log(to.path,from)
      	//变化之后根据自己项目需求写自身的逻辑代码,下面只是示例
      	if(to.path=='/personal'||to.path=='/transfer'){
        	this.isHeader=false
      	}else {
        	this.isHeader=true
      	}
    },
}
Logo

前往低代码交流专区

更多推荐