forked from AkkomaGang/admin-fe
refine permission example
This commit is contained in:
parent
703c0c5cc5
commit
ecf7558e8e
2 changed files with 13 additions and 2 deletions
|
@ -132,6 +132,16 @@ const user = {
|
|||
Cookies.remove('Admin-Token');
|
||||
resolve();
|
||||
});
|
||||
},
|
||||
|
||||
// 动态修改权限
|
||||
ChangeRole({ commit }, role) {
|
||||
return new Promise(resolve => {
|
||||
commit('SET_ROLES', [role]);
|
||||
commit('SET_TOKEN', role);
|
||||
Cookies.set('Admin-Token', role);
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -23,8 +23,9 @@
|
|||
},
|
||||
watch: {
|
||||
role(val) {
|
||||
this.$store.commit('SET_ROLES', [val]);
|
||||
this.$router.push({ path: '/permission/index?' + +new Date() });
|
||||
this.$store.dispatch('ChangeRole', val).then(() => {
|
||||
this.$router.push({ path: '/permission/index?' + +new Date() });
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue