mirror of
https://github.com/fantastic-admin/basic.git
synced 2026-10-07 13:07:58 +08:00
20 lines
486 B
JavaScript
20 lines
486 B
JavaScript
import { useAuth } from '@/utils/composables'
|
|
|
|
export default function directive(app) {
|
|
// 注册 v-auth 和 v-auth-all 指令
|
|
app.directive('auth', {
|
|
mounted: (el, binding) => {
|
|
if (!useAuth().auth(binding.value)) {
|
|
el.remove()
|
|
}
|
|
}
|
|
})
|
|
app.directive('auth-all', {
|
|
mounted: (el, binding) => {
|
|
if (!useAuth().authAll(binding.value)) {
|
|
el.remove()
|
|
}
|
|
}
|
|
})
|
|
}
|