mirror of
https://github.com/fantastic-admin/basic.git
synced 2026-10-07 16:18:19 +08:00
12 lines
376 B
TypeScript
Executable File
12 lines
376 B
TypeScript
Executable File
import type { App, DirectiveBinding } from 'vue'
|
|
|
|
export default function directive(app: App) {
|
|
app.directive('auth', (el: HTMLElement, binding: DirectiveBinding) => {
|
|
watch(() => binding.modifiers.all ? useAuth().authAll(binding.value) : useAuth().auth(binding.value), (val) => {
|
|
el.style.display = val ? '' : 'none'
|
|
}, {
|
|
immediate: true,
|
|
})
|
|
})
|
|
}
|