Unverified Commit 9a833878 by 言肆 Committed by GitHub

Merge pull request #110 from AClumsy/patch-1

fix: $route.meta.permission to Array type, invalid v-action management
parents b052d5ee bc8a4e3a
...@@ -84,17 +84,16 @@ const action = Vue.directive('action', { ...@@ -84,17 +84,16 @@ const action = Vue.directive('action', {
bind: function (el, binding, vnode) { bind: function (el, binding, vnode) {
const actionName = binding.arg const actionName = binding.arg
const roles = store.getters.roles const roles = store.getters.roles
const permissionId = vnode.context.$route.meta.permission const elVal = vnode.context.$route.meta.permission
let actions = [] const permissionId = elVal instanceof String && [elVal] || elVal
roles.permissions.forEach(p => { roles.permissions.forEach(p => {
if (p.permissionId !== permissionId) { if (!permissionId.includes(p.permissionId)) {
return return
} }
actions = p.actionList if (p.actionList && !p.actionList.includes(actionName)) {
})
if (actions.indexOf(actionName) < 0) {
el.parentNode && el.parentNode.removeChild(el) || (el.style.display = 'none') el.parentNode && el.parentNode.removeChild(el) || (el.style.display = 'none')
} }
})
} }
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment