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 } ] } ]