diff --git a/src/main.js b/src/main.js index fb16470030bb7c6e03351bb888d96373cd77029e..c434c2f40ef44396db54ba445cc589172d98432d 100644 --- a/src/main.js +++ b/src/main.js @@ -43,7 +43,10 @@ new Vue({ router, store, mounted(){ - this.$store.commit('updateMenuList', appRouters); + // if(localStorage) + // 这里需要做判断是否是owner角色登录 + this.$store.commit('initMenuList', appRouters); + // this.$store.commit('updateMenuList', appRouters); }, render: h => h(App) }).$mount('#app') diff --git a/src/router/router.js b/src/router/router.js index 0de6ca50e939c404a8651228954773bf3e42ebf0..e8db136e73ccdd98445101b8877ff6fcfe0fe35e 100644 --- a/src/router/router.js +++ b/src/router/router.js @@ -49,6 +49,7 @@ export const appRouters = [ name:'markdownEditor', title:'markdown编辑', icon:'md-brush', + access: 1, component:Home, children:[ { diff --git a/src/store/modules/app.js b/src/store/modules/app.js index fc0e8425fa43b32fd949e061101c9ae13799e240..06a12a572b9554be74dc7bd9fa681d1e59b8bf47 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -3,6 +3,15 @@ const app = { menuList:[] }, mutations:{ + // 以游客身份登入或者尚未登录 + initMenuList(state, router){ + router.forEach(element => { + if(!element.access){ + state.menuList.push(element); + } + }); + }, + // 以管理员的角色登录 updateMenuList(state, router){ console.log("something"); console.log(router);