|
@@ -209,21 +209,21 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
watch: {
|
|
|
- //监听路由
|
|
|
- // $route: {
|
|
|
- // handler: function(val, oldVal) {
|
|
|
- // if (val.query.root) this.currRoot = val.query.root;
|
|
|
+ // 监听路由
|
|
|
+ $route: {
|
|
|
+ handler: function(val, oldVal) {
|
|
|
+ if (val.query.root) this.currRoot = val.query.root;
|
|
|
|
|
|
- // this.currentMenu.some((element, index) => {
|
|
|
- // if (element.path == val.path) {
|
|
|
- // this.activeIndex = index;
|
|
|
- // return true;
|
|
|
- // }
|
|
|
- // });
|
|
|
- // },
|
|
|
- // //深度观察监听
|
|
|
- // deep: true,
|
|
|
- // },
|
|
|
+ this.currentMenu.some((element, index) => {
|
|
|
+ if (element.path == val.path) {
|
|
|
+ this.activeIndex = index;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //深度观察监听
|
|
|
+ deep: true,
|
|
|
+ },
|
|
|
root: {
|
|
|
handler: function(val, oldVal) {
|
|
|
this.currRoot = val;
|
|
@@ -235,13 +235,13 @@ export default {
|
|
|
// 基于 root 和 currRoot 为一致
|
|
|
// 进行页面刷新
|
|
|
// 防止 刷新页面也同步执行切换页面逻辑
|
|
|
- // if (this.root == this.currRoot) {
|
|
|
- // this.activeIndex = 0;
|
|
|
- // this.$router.push({
|
|
|
- // path: val[0].path,
|
|
|
- // query: { root: this.currRoot },
|
|
|
- // });
|
|
|
- // }
|
|
|
+ if (this.root == this.currRoot) {
|
|
|
+ this.activeIndex = 0;
|
|
|
+ this.$router.push({
|
|
|
+ path: val[0].path,
|
|
|
+ query: { root: this.currRoot },
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
},
|