diff --git a/template/admin/src/components/main/components/side-menu/side-menu.vue b/template/admin/src/components/main/components/side-menu/side-menu.vue index 21adadeb0..07de96187 100644 --- a/template/admin/src/components/main/components/side-menu/side-menu.vue +++ b/template/admin/src/components/main/components/side-menu/side-menu.vue @@ -170,6 +170,15 @@ export default { this.$refs.menu.updateOpened(); }); }, + collapsed(val) { + if (!val) { + console.log(this.$route, this.findParentById(this.menuList, this.$route.path)); + this.handleSelect(this.findParentById(this.menuList, this.$route.path)); + this.$nextTick(() => { + this.$refs.childMenu.updateOpened(); + }); + } + }, $route(newRoute) {}, $route: { handler(newRoute) { @@ -189,9 +198,9 @@ export default { console.log(this.menuList); this.openedNames = getUnion(this.openedNames, this.getOpenedNamesByActiveName()); if (sessionStorage.getItem('menuActive')) { - // this.activeMenuPath = sessionStorage.getItem('menuActive'); - // this.catName = sessionStorage.getItem('menuActiveTitle'); - // this.getChildrenList(sessionStorage.getItem('menuActive')); + this.activeMenuPath = sessionStorage.getItem('menuActive'); + this.catName = sessionStorage.getItem('menuActiveTitle'); + this.getChildrenList(sessionStorage.getItem('menuActive')); } else { this.handleSelect(this.openedNames[0]); } @@ -256,11 +265,12 @@ export default { this.turnToPage(name); }, collHandleSelect(name) { + console.log(this.menuList) this.activeMenuPath = this.findParentById(this.menuList, name); this.turnToPage(name); }, findParentById(arr, path) { - var parentId = '没有父元素', + var parentId = '', hasParentId = (function loop(arr) { return arr.some((item) => { if (item.path === path) { @@ -338,7 +348,6 @@ export default {