diff --git a/src/pages/Home.vue b/src/pages/Home.vue index 5cdaff5..35fa918 100644 --- a/src/pages/Home.vue +++ b/src/pages/Home.vue @@ -17,7 +17,6 @@ @@ -43,7 +42,7 @@ {{selectedSubMenu}} -
+
@@ -68,7 +67,7 @@ mainUrl: "/customer/view", isCollapsed: false, mHeight: 600, - selectedItemName: null, + selectedItemName: "", openName: [], selectedMenu: '', selectedSubMenu: '', @@ -88,32 +87,32 @@ }, mounted() { let that = this; - this.bus.$on('callBack', function () { - that.callBack(); - }) - this.bus.$on('setHeader', function (data) { - that.setHeader(data); + this.bus.$on('callBack', function (item) { + that.callBack(item); }) + // this.bus.$on('setHeader', function (data) { + // that.setHeader(data); + // }) }, created() { - this.mHeight = window.screen.availHeight - 22; + // this.mHeight = window.screen.availHeight - 22; //获取导航栏权限 this.listOnePermission(this.onePermissionLevel); }, computed: { - rotateIcon() { - return [ - 'menu-icon', - this.isCollapsed ? 'rotate-icon' : '' - ]; - }, - menuitemClasses() { - return [ - 'menu-item', - this.isCollapsed ? 'collapsed-menu' : '' - ] + + }, + watch: { + 'selectedItemName' (val) { + console.log(val); + let that = this; + // that.openName = [that.onePermissionList[2]]; + this.$nextTick(() => { + that.$refs.menu.updateActiveName(); + }); } + }, methods: { onSelectLister(val) { @@ -134,6 +133,7 @@ this.selectedSubMenu = ""; this.breadcrumbUrl = this.mainUrl; } + for (let i = 0; i < this.onePermissionList.length; i++) { let item = this.onePermissionList[i]; for (let k = 0; k < item.subMenuList.length; k++) { @@ -141,6 +141,7 @@ if (cItem.id === val) { this.selectedMenu = item.name; this.selectedSubMenu = cItem.name; + this.selectedItemName = cItem.id; this.breadcrumbUrl = cItem.resource; } } @@ -266,29 +267,25 @@ }else{ that.selectedItemName = that.onePermissionList[0].subMenuList[0].id; that.openName = [that.onePermissionList[0].id]; - this.$nextTick(() => { - this.$refs.menu.updateOpened(); - this.$refs.menu.updateActiveName(); - }); + this.selectedMenu = this.onePermissionList[0].name; this.selectedSubMenu = this.onePermissionList[0].subMenuList[0].name; sessionStorage.setItem("threeLevel",JSON.stringify(this.onePermissionList[0].subMenuList[0].subMenuList)); + // this.$nextTick(() => { + // this.$refs.menu.updateOpened(); + // this.$refs.menu.updateActiveName(); + // }); this.$router.push({path: that.onePermissionList[0].subMenuList[0].resource}); } }, //账户管理页面回调方法 - callBack() { + callBack(item) { let that = this; - debugger this.selectedMenu = "设置管理"; this.selectedSubMenu = "账户管理"; this.selectedItemName = this.onePermissionList[2].subMenuList[0].id; - - // this.$router.push({path: '/account/manager',query:item}); - // this.$nextTick(() => { - // that.$refs.menu.updateActiveName(); - // }) + this.$router.push({path: '/account/manager',query:item}); }, setHeader(data){ let that = this; @@ -318,7 +315,6 @@ this.$Message.info("登出成功"); } }, - }