|
@@ -7,6 +7,9 @@ export default function access(initialState: { currentUser?: API.CurrentUser | u
|
|
|
if (initialState?.currentUser?.account === 'admin') {
|
|
|
return true
|
|
|
}
|
|
|
+ // 1.从数组中过滤出以view开头的perm的新数组 (ES6 filter)
|
|
|
+ // 2.将过滤后的perm中的viewAaaa Aaaa匹配出来将Aaaa转换成aaaa (ES6 map以及字符串的match正则匹配) 不会就百度找一堆答案
|
|
|
+ // 3.对route.name进行判断,匹配通过
|
|
|
const permissionList = permission.map(item => item.match(/^view(\w*)/)).map(item => item[1])
|
|
|
const newPermission = permissionList.map(item => item.replace(item[0], item[0].toLowerCase()))
|
|
|
|