From 507ea137e41c8369c74a5db4ad0eb85f99049603 Mon Sep 17 00:00:00 2001 From: hongawen <83944980@qq.com> Date: Thu, 10 Oct 2024 15:45:37 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=BE=AE=E8=B0=83=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B0=81=E8=A3=85=E7=9A=84=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=8C=87=E4=BB=A4=EF=BC=8C=E5=85=B6=E4=B8=AD=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6=E5=8F=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/directives/modules/auth.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/frontend/src/directives/modules/auth.ts b/frontend/src/directives/modules/auth.ts index a9c9fe4..8745f7b 100644 --- a/frontend/src/directives/modules/auth.ts +++ b/frontend/src/directives/modules/auth.ts @@ -2,21 +2,21 @@ * v-auth * 按钮权限指令 */ -import { useAuthStore } from "@/stores/modules/auth"; -import type { Directive, DirectiveBinding } from "vue"; +import { useAuthStore } from '@/stores/modules/auth' +import type { Directive, DirectiveBinding } from 'vue' const auth: Directive = { mounted(el: HTMLElement, binding: DirectiveBinding) { - const { value } = binding; - const authStore = useAuthStore(); - const currentPageRoles = authStore.authButtonListGet[authStore.routeName] ?? []; + const { value } = binding + const authStore = useAuthStore() + const currentPageRoles = authStore.authButtonListGet[authStore.routeName] ?? [] if (value instanceof Array && value.length) { - const hasPermission = value.every(item => currentPageRoles.includes(item)); - if (!hasPermission) el.remove(); + const hasPermission = value.every(item => currentPageRoles.includes(item)) + if (!hasPermission) el.remove() } else { - if (!currentPageRoles.includes(value)) el.remove(); + if (!currentPageRoles.includes(value)) el.remove() } - } -}; + }, +} -export default auth; +export default auth