diff --git a/src/layout/index.vue b/src/layout/index.vue index e0c2f5d..b303d4b 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -92,11 +92,10 @@ }, watch: { $route: { - handler({ fullPath, matched }) { - //暂未研究清楚此处,待改进 - if (fullPath === '/index') fullPath = '/' - if (fullPath === '/test/test') fullPath = '/test' - this.selectedKeys = [fullPath] + handler({ path, matched }) { + matched[0].children.length > 1 + ? (this.selectedKeys = [path]) + : (this.selectedKeys = [matched[0].path]) this.openKeys = [matched[0].path] }, immediate: true, diff --git a/src/layout/vab-menu/components/MenuItem.vue b/src/layout/vab-menu/components/MenuItem.vue index 2f7e8e0..41936e4 100644 --- a/src/layout/vab-menu/components/MenuItem.vue +++ b/src/layout/vab-menu/components/MenuItem.vue @@ -1,5 +1,5 @@