From 594dbfde9344ce38c36cde30231c3aef142ec552 Mon Sep 17 00:00:00 2001 From: xing Date: Wed, 17 Jun 2020 18:04:40 +0800 Subject: [PATCH] =?UTF-8?q?=E7=82=B9=E5=87=BB=E8=8F=9C=E5=8D=95=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E5=88=B0=E6=8C=87=E5=AE=9A=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Home.vue | 22 +++++++++++++++------- src/components/users/users.vue | 14 ++++++++++++++ src/router/router.js | 16 +++++----------- 3 files changed, 34 insertions(+), 18 deletions(-) create mode 100644 src/components/users/users.vue diff --git a/src/components/Home.vue b/src/components/Home.vue index 9c933b8..6bcb163 100644 --- a/src/components/Home.vue +++ b/src/components/Home.vue @@ -13,7 +13,7 @@ @@ -24,11 +24,15 @@ {{item.authName}} - - - - - {{subitem.authName}} + + @@ -58,7 +62,8 @@ export default { 145: 'iconfont icon-baobiao' }, isCollapsed: false, - width: '200px' + width: '200px', + activeNav: sessionStorage.getItem('menuActive') } }, methods: { @@ -69,6 +74,9 @@ export default { sessionStorage.clear() this.$router.push('/login') }, + saveNavActive (nav) { + sessionStorage.setItem('menuActive', nav) + }, async getMenuList () { const { data: res } = await this.$http.get('menus') if (res.meta.status !== 200) { diff --git a/src/components/users/users.vue b/src/components/users/users.vue new file mode 100644 index 0000000..8ac8e93 --- /dev/null +++ b/src/components/users/users.vue @@ -0,0 +1,14 @@ + + + + diff --git a/src/router/router.js b/src/router/router.js index eb4a380..27bcbcc 100644 --- a/src/router/router.js +++ b/src/router/router.js @@ -3,26 +3,20 @@ import VueRouter from 'vue-router' import Login from '../components/Login' import Home from '../components/Home' import welcome from '../components/welcome' +import users from '../components/users/users' Vue.use(VueRouter) const routes = [ - { - path: '/', redirect: '/login' - }, - { - path: '/login', - component: Login - }, + { path: '/', redirect: '/login' }, + { path: '/login', component: Login }, { path: '/home', component: Home, redirect: '/welcome', children: [ - { - path: '/welcome', - component: welcome - } + { path: '/welcome', component: welcome }, + { path: '/users', component: users } ] } ]