1.封装一个方法 遍历,来获取用户是否有该数据 auth 方法
import storage from './storage'
export default (code) => {
const currentPermission = storage.permissions ? storage.permissions : [];
for(let authItem of currentPermission) {
if (code === authItem) {
return true
}
}
return false
}
import 是导入获取本地数组
- 导入 使用