From 6ba67905ae3e502103a940f5f6f907e8f491ae62 Mon Sep 17 00:00:00 2001 From: 王旭 <1377869194@qq.com> Date: 星期四, 13 十月 2022 17:13:11 +0800 Subject: [PATCH] 用户角色授权页面接口对接 --- src/components/navMenu.vue | 26 ++++++++++++++++++++++++-- 1 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/components/navMenu.vue b/src/components/navMenu.vue index 29a68b1..1bcffec 100644 --- a/src/components/navMenu.vue +++ b/src/components/navMenu.vue @@ -67,7 +67,20 @@ mounted() { this.getMenuTree(); }, - computed: {}, + computed: { + // 鎴戜滑浣跨敤璁$畻灞炴�ф潵鑾峰彇鍒板綋鍓嶇偣鍑荤殑鑿滃崟鐨勮矾鐢辫矾寰勶紝鐒跺悗璁剧疆default-active涓殑鍊� + // 浣垮緱鑿滃崟鍦ㄨ浇鍏ユ椂灏辫兘瀵瑰簲楂樹寒 + // activeIndex() { + // const route = this.$route; + // const { meta, path } = route; + // // if set path, the sidebar will highlight the path you set + // // 鍙互鍦ㄨ矾鐢遍厤缃枃浠朵腑璁剧疆鑷畾涔夌殑璺敱璺緞鍒癿eta.activeMenu灞炴�т腑锛屾潵鎺у埗鑿滃崟鑷畾涔夐珮浜樉绀� + // if (meta.activeMenu) { + // return meta.activeMenu; + // } + // return path; + // }, + }, methods: { getMenuTree() { //鑾峰彇鐩綍鏍戞渶澶D锛屾柊寤鸿妭鐐逛娇鐢� @@ -160,9 +173,18 @@ }, watch: { $route() { - this.activeIndex = this.$route.path; + let str = this.$route.path; + if (str[0] == "/") { + this.activeIndex = str.slice(1); + } }, }, + created() { + let str = this.$route.path; + if (str[0] == "/") { + this.activeIndex = str.slice(1); + } + }, }; </script> <style lang="less" scoped> -- Gitblit v1.9.3