first commit

This commit is contained in:
annnj-company
2026-04-17 18:29:53 +08:00
parent e49fa5a215
commit 130c1026c4
5615 changed files with 1639145 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
import permission from './permission'
const install = function (Vue) {
Vue.directive('auth', permission)
}
permission.install = install
export default permission

View File

@@ -0,0 +1,21 @@
import store from 'store'
export default {
/**
* 权限判断
* inserted: 被绑定元素插入父节点时调用 (仅保证父节点存在,但不一定已被插入文档中)。
* componentUpdated: 指令所在组件的 VNode 及其子 VNode 全部更新后调用。
*/
inserted (el, binding, vnode) {
const { value } = binding
const access = store.get('access') || {}
if (value) {
const hasPermission = Object.values(access).includes(value)
if (!hasPermission) {
el.parentNode && el.parentNode.removeChild(el)
}
} else {
console.log(`v-auth="'admin/menu/add'"`)
}
}
}