Vue 不同路由对应同一页面 监测路由变化更改数据 阿星小栈

vue

   watch: {

orgTreeShow(val){

if(val){

this.employeesShow = false;

}else{

this.loadEmployees()

}

}

},

beforeUpdate: function(){

console.log('beforethis.$route',this.$route);

if(this.$route.fullPath === '/company-manage/dept-frame' || this.$route.fullPath === '/theatre-manage/dept-frame'){

this.orgTreeShow = true

}else{

this.orgTreeShow = false;

}

},

created () {

console.log('this.$route',this.$route);

this.orgTreeShow = false;

if(this.$route.fullPath === '/company-manage/dept-frame' || this.$route.fullPath === '/theatre-manage/dept-frame'){

this.orgTreeShow = true

}

if(this.orgTreeShow){

this.loadDeptsTree()

}else{

this.loadEmployees()

}

},

以上是 Vue 不同路由对应同一页面 监测路由变化更改数据 阿星小栈 的全部内容, 来源链接: utcz.com/z/375552.html

回到顶部