From 137187fed69838ad34f65afa778f0cc9ed8ceed0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=9D=A8?= <1711467488@qq.com> Date: Wed, 24 Jan 2018 22:26:12 +0800 Subject: [PATCH] no message Former-commit-id: 7b3fddd98d854f89e0357006e317cba47fd9be0f Former-commit-id: 1b033b5f22388fc303b45d1b1f69504f582a34cc Former-commit-id: e449874c389b784a04f7cd1e891a8a272f781f8d --- .../core/MainLayout/_headerMenu.vue | 21 ++--- .../core/MainLayout/_headerMenu_bak.vue | 88 +++++++++++++++++++ src/pages/core/login/index.vue | 23 +---- 3 files changed, 97 insertions(+), 35 deletions(-) create mode 100644 src/components/core/MainLayout/_headerMenu_bak.vue diff --git a/src/components/core/MainLayout/_headerMenu.vue b/src/components/core/MainLayout/_headerMenu.vue index 519b4c07..ea3f6f8b 100644 --- a/src/components/core/MainLayout/_headerMenu.vue +++ b/src/components/core/MainLayout/_headerMenu.vue @@ -26,32 +26,21 @@ export default { routeName () { return this.$route.name }, - // 当前路由是否是顶级菜单 - // 顶级菜单就是在顶栏里显示的菜单 - // 二级菜单是在侧边栏显示的菜单 - // 三级菜单是二级菜单展开的 - routeIsTopLevel () { - return !!this.router.find(e => e.name === this.routeName) - }, // 不管当前路由是不是顶级菜单 都返回这个路由所属的顶级菜单对象的name // 如果返回 undefined 代表这个路由不是在菜单里显示的路由 - routeTopLevel () { - if (this.routeIsTopLevel) { + routeTopLevelName () { + if (this.router.find(e => e.name === this.routeName)) { return this.routeName } else { - const find = this.router.find(e => { - return e.children.find(child => { - return child.name === this.routeName - }) - }) + const find = this.router.find(e => e.children.find(child => child.name === this.routeName)) return find ? find.name : undefined } }, // 返回当前对象对应的顶级菜单 这个菜单可以在侧边栏菜单中直接使用 // 如果返回 undefined 代表这个路由没有对应的一级路由也就没有菜单 routeTopLevelMenu () { - if (this.routeTopLevel) { - return this.menu.find(e => e.name === this.routeTopLevel).children + if (this.routeTopLevelName) { + return this.menu.find(e => e.name === this.routeTopLevelName).children } else { return undefined } diff --git a/src/components/core/MainLayout/_headerMenu_bak.vue b/src/components/core/MainLayout/_headerMenu_bak.vue new file mode 100644 index 00000000..519b4c07 --- /dev/null +++ b/src/components/core/MainLayout/_headerMenu_bak.vue @@ -0,0 +1,88 @@ + + + diff --git a/src/pages/core/login/index.vue b/src/pages/core/login/index.vue index 27649e86..9b6a141e 100644 --- a/src/pages/core/login/index.vue +++ b/src/pages/core/login/index.vue @@ -7,33 +7,18 @@
- + - + - + - +