diff --git a/src/page/index/index.vue b/src/page/index/index.vue index f20b3d1..c224dec 100755 --- a/src/page/index/index.vue +++ b/src/page/index/index.vue @@ -61,39 +61,41 @@ export default { computed: { ...mapGetters(["isHorizontal", "isRefresh", "isLock", "isCollapse", "isSearch", "menu", "setting",]), validSidebar () { - return !((this.$route.meta || {}).menu == false || (this.$route.query || {}).menu == 'false') + return !((this.$route.meta || {}).menu === false || (this.$route.query || {}).menu === 'false') } }, props: [], methods: { //打开菜单 - openMenu (item = {}) { - this.$store.dispatch("GetMenu", item.parentId).then(data => { + openMenu(item = {}) { + this.$store.dispatch("GetMenu", item.id).then(data => { if (data.length !== 0) { this.$router.$avueRouter.formatRoutes(data, true); } - //当点击顶部菜单做的事件 - if (!validatenull(item)) { + //当点击顶部菜单后默认打开第一个菜单 + /*if (!this.validatenull(item)) { let itemActive = {}, childItemActive = 0; - //vue-router路由 if (item.path) { itemActive = item; } else { - if (this.menu[childItemActive].length == 0) { + if (this.menu[childItemActive].length === 0) { itemActive = this.menu[childItemActive]; } else { itemActive = this.menu[childItemActive].children[childItemActive]; } } - this.$store.commit('SET_MENUID', item); + this.$store.commit('SET_MENU_ID', item); this.$router.push({ - path: itemActive.path + path: this.$router.$avueRouter.getPath({ + name: (itemActive.label || itemActive.name), + src: itemActive.path + }, itemActive.meta) }); - } + }*/ }); }, } }; - \ No newline at end of file + diff --git a/src/page/index/top/top-menu.vue b/src/page/index/top/top-menu.vue index 60f4a99..6f6c797 100755 --- a/src/page/index/top/top-menu.vue +++ b/src/page/index/top/top-menu.vue @@ -3,13 +3,20 @@ :default-active="activeIndex" mode="horizontal" text-color="#333"> -