File tree Expand file tree Collapse file tree 1 file changed +7
-15
lines changed Expand file tree Collapse file tree 1 file changed +7
-15
lines changed Original file line number Diff line number Diff line change @@ -84,24 +84,16 @@ const action = Vue.directive('action', {
84
84
bind : function ( el , binding , vnode ) {
85
85
const actionName = binding . arg
86
86
const roles = store . getters . roles
87
- const permissionId = vnode . context . $route . meta . permission
88
- let actions = [ ]
87
+ const elVal = vnode . context . $route . meta . permission
88
+ const permissionId = elVal instanceof String && [ elVal ] || elVal
89
89
roles . permissions . forEach ( p => {
90
- //$route.meta.permission 是否配置Array类型
91
- if ( Array . isArray ( permissionId ) ) {
92
- if ( ! permissionId . includes ( p . permissionId ) ) {
93
- return
94
- }
95
- } else {
96
- if ( p . permissionId !== permissionId ) {
97
- return
98
- }
90
+ if ( ! permissionId . includes ( p . permissionId ) ) {
91
+ return
92
+ }
93
+ if ( p . actionList && ! p . actionList . includes ( actionName ) ) {
94
+ el . parentNode && el . parentNode . removeChild ( el ) || ( el . style . display = 'none' )
99
95
}
100
- actions = p . actionList
101
96
} )
102
- if ( ! actions . includes ( actionName ) ) {
103
- el . parentNode && el . parentNode . removeChild ( el ) || ( el . style . display = 'none' )
104
- }
105
97
}
106
98
} )
107
99
You can’t perform that action at this time.
0 commit comments