UNPKG

yinghe-lowcode

Version:

基于vue、ant-design-vue,datagrid的低代码平台

41 lines (38 loc) 1.15 kB
/* * @Author: your name * @Date: 2021-08-30 16:42:52 * @LastEditTime: 2022-03-10 09:58:58 * @LastEditors: Please set LastEditors * @Description: In User Settings Edit * @FilePath: \cdyw-ui\src\directive\permission\hasPermi.js */ /** * 操作权限处理 * Copyright (c) 2020 */ export default { inserted(el, binding, vnode) { const { value } = binding const allPermission = '*:*:*' const permissions = JSON.parse( sessionStorage.getItem("SYS_BUTTON_AUTH") || "[]" ) if (value && value instanceof Array && value.length > 0) { const permissionFlag = value if (value.length === 1 && !value[0]) { console.log('未配置权限') } else { // const hasPermissions = permissions.some(permission => { // return allPermission === permission || permissionFlag.includes(permission)|| permissionFlag.indexOf(permission)>=0 // }) // if (!hasPermissions) { // el.parentNode && el.parentNode.removeChild(el) // } } } else { throw new Error(`请设置操作权限标签值`) } } }