diff --git a/template/admin/src/components/main/components/side-menu/collapsed-menu.vue b/template/admin/src/components/main/components/side-menu/collapsed-menu.vue
index d6d636078..bf3834eda 100644
--- a/template/admin/src/components/main/components/side-menu/collapsed-menu.vue
+++ b/template/admin/src/components/main/components/side-menu/collapsed-menu.vue
@@ -30,7 +30,7 @@
:key="`drop-${child.path}`"
>
diff --git a/template/admin/src/components/main/components/side-menu/side-menu.less b/template/admin/src/components/main/components/side-menu/side-menu.less
index f3201f3bd..05a2ee1e9 100644
--- a/template/admin/src/components/main/components/side-menu/side-menu.less
+++ b/template/admin/src/components/main/components/side-menu/side-menu.less
@@ -36,7 +36,7 @@
}
}
.ivu-select-dropdown{
- left: 95px !important;
+ // left: 95px !important;
}
.menu-title {
// padding-left: 6px;
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 61e275f84..404a45d5f 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
@@ -146,29 +146,108 @@ export default {
catName: '',
};
},
+ computed: {
+ ...mapState('menus', ['openMenus']),
+ textColor() {
+ return this.theme === 'dark' ? '#fff' : '#495060';
+ },
+ },
+ watch: {
+ activeName(name) {
+ if (this.accordion) this.openedNames = this.getOpenedNamesByActiveName();
+ else this.openedNames = getUnion(this.openedNames, this.getOpenedNamesByActiveName());
+ // this.handleSelect(this.activeName);
+ },
+ openNames(newNames) {
+ this.openedNames = newNames;
+ },
+ openedNames() {
+ this.$nextTick(() => {
+ this.$refs.menu.updateOpened();
+ });
+ },
+ $route(newRoute) {},
+ $route: {
+ handler(newRoute) {
+ console.log(newRoute, 'newRoutenewRoute');
+ this.activePath = newRoute.path;
+ // this.activeMenuPath = newRoute.matched[0].path;
+ this.handleUpdateMenuState();
+ },
+ immediate: true,
+ },
+ },
+ mounted() {
+ 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'));
+ } else {
+ console.log(this.openedNames);
+ this.handleSelect(this.openedNames[0]);
+ }
+ },
methods: {
+ getChildrenList(path) {
+ this.menuList.map((e) => {
+ if (e.path === path) {
+ console.log(e, 'eeee');
+ this.childList = e.children || [];
+ }
+ });
+ },
handleSelect(name, type) {
- if (!type) {
- this.$emit('on-select', name);
- }
this.childOptions = [];
this.menuList.map((e) => {
if (e.path === name) {
console.log(e, 'eeee');
- if (e.children) {
+ if (e.children && e.children.length) {
+ console.log(e.children, 'e.children');
+ this.jump(e.children);
this.catName = e.title;
- this.activeMenuPath = e.path;
+ console.log('1');
+ // this.activeMenuPath = e.path;
this.childList = e.children || [];
- this.activeChildName = e.children[0].path;
- this.childOptions = [e.children[0].path];
+ sessionStorage.setItem('menuActive', e.path);
+ sessionStorage.setItem('menuActiveTitle', e.title);
+ this.activeMenuPath = e.path;
+ // this.activeChildName = e.children[0].path;
+ // this.childOptions = [e.children[0].path];
this.$store.commit('menus/childMenuList', this.childList);
+ // if (!type) {
+ // this.$emit('on-select', e.children[0].path);
+ // }
} else {
+ console.log('2');
+
+ if (!type) {
+ this.$emit('on-select', name);
+ }
+ this.activeMenuPath = e.path;
+
this.childList = [];
this.$store.commit('menus/childMenuList', []);
}
}
});
},
+ jump(data) {
+ if (data[0].children && data[0].children.length) {
+ console.log('3');
+ this.jump(data[0].children);
+ } else {
+ console.log('4');
+
+ this.catName = data[0].title;
+ // this.activeMenuPath = data[0].path;
+ this.activeChildName = data[0].path;
+ this.childOptions = [data[0].path];
+ this.$store.commit('menus/childMenuList', this.childList);
+ this.$emit('on-select', data[0].path);
+ }
+ },
handleChildSelect(name) {
this.turnToPage(name);
},
@@ -212,43 +291,6 @@ export default {
});
},
},
- computed: {
- ...mapState('menus', ['openMenus']),
- textColor() {
- return this.theme === 'dark' ? '#fff' : '#495060';
- },
- },
- watch: {
- activeName(name) {
- if (this.accordion) this.openedNames = this.getOpenedNamesByActiveName();
- else this.openedNames = getUnion(this.openedNames, this.getOpenedNamesByActiveName());
- // this.handleSelect(this.activeName);
- },
- openNames(newNames) {
- this.openedNames = newNames;
- },
- openedNames() {
- this.$nextTick(() => {
- this.$refs.menu.updateOpened();
- });
- },
- $route(newRoute) {},
- $route: {
- handler(newRoute) {
- console.log(newRoute, 'newRoutenewRoute');
- this.activePath = newRoute.path;
- this.activeMenuPath = newRoute.matched[0].path;
- this.handleUpdateMenuState();
- console.log(activeMenuPath, 'activeMenuPath');
- },
- immediate: true,
- },
- },
- mounted() {
- this.openedNames = getUnion(this.openedNames, this.getOpenedNamesByActiveName());
- this.handleSelect(this.openedNames[0], 'one');
- this.activeMenuPath = this.openedNames[0];
- },
};