From 2602bdd82484dabf3db312add0930a93b00e6969 Mon Sep 17 00:00:00 2001 From: ZKBH <1113799@qq.com> Date: 星期一, 28 七月 2025 11:43:01 +0800 Subject: [PATCH] 台账样式 --- src/components/menu/index.js | 22 ++++++++++++++++++++-- 1 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/components/menu/index.js b/src/components/menu/index.js index fc2124d..d47076c 100644 --- a/src/components/menu/index.js +++ b/src/components/menu/index.js @@ -59,7 +59,6 @@ methods: { // select menu item onOpenChange (openKeys) { - // 鍦ㄦ按骞虫ā寮忎笅鏃舵墽琛岋紝骞朵笖涓嶅啀鎵ц鍚庣画 if (this.mode === 'horizontal') { this.openKeys = openKeys @@ -161,13 +160,32 @@ </Item> ) }, + handleTitleClick(record,event){ + this.selectedKeys=[] + const routes = this.$route.matched.concat() + const { hidden } = this.$route.meta + + if (routes.length >= 3 && hidden) { + routes.pop() + this.selectedKeys = [routes[routes.length - 1].path] + } else { + if (record.path === '/dashboard/analysis') { + //濡傛灉鏄椤靛垯鐩存帴璺宠浆棣栭〉 + this.selectedKeys = [record] + } else if (record.children && record.children.length > 0) { + //濡傛灉涓嶆槸棣栭〉涓旀湁瀛愯彍鍗曞垯灞曞紑鐐瑰嚮鏍囬涓嬬殑鎵�鏈変笉鍚笅绾ц彍鍗曠殑瀛愯彍鍗曡嚦瀵艰埅鏍忓苟鎵撳紑绗竴涓瓙鑿滃崟椤甸潰锛岃嫢瀛愯彍鍗曟爣棰樹笅浠嶆湁涓嬩竴绾ц彍鍗曞垯鍙渶瑕佺偣鍑诲惈涓嬬骇鑿滃崟鐨勫瓙鑿滃崟鏍囬鍗冲彲 + this.selectedKeys = record.children.filter(item => !item.hidden&&!item.children) + } + } + this.$bus.$emit('clickMenuTitleSelected', this.selectedKeys) + }, renderSubMenu (menu) { const itemArr = [] if (!menu.alwaysShow) { menu.children.forEach(item => itemArr.push(this.renderItem(item))) } return ( - <SubMenu {...{ key: menu.path }}> + <SubMenu {...{ key: menu.path }} onTitleClick={this.handleTitleClick.bind(this.$event,menu)}> <span slot="title"> {this.renderIcon(menu.meta.icon)} <span>{menu.meta.title}</span> -- Gitblit v1.9.3