types: 优化自定义指令的类型提示 (#1161)

This commit is contained in:
sea
2024-06-06 16:26:32 +08:00
committed by GitHub
parent 33a89834d7
commit a75cf8394e
8 changed files with 69 additions and 18 deletions

View File

@@ -2,7 +2,7 @@ import { hasAuth } from "@/router/utils";
import type { Directive, DirectiveBinding } from "vue";
export const auth: Directive = {
mounted(el: HTMLElement, binding: DirectiveBinding) {
mounted(el: HTMLElement, binding: DirectiveBinding<string | Array<string>>) {
const { value } = binding;
if (value) {
!hasAuth(value) && el.parentNode?.removeChild(el);