提交 b5f8aefa 编写于 作者: BeMount's avatar BeMount 💬

fix(/main.js): 给用户角色限权

上级 277680c7
......@@ -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')
......@@ -49,6 +49,7 @@ export const appRouters = [
name:'markdownEditor',
title:'markdown编辑',
icon:'md-brush',
access: 1,
component:Home,
children:[
{
......
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册