From 1a6e5d22fdbe2d11aed22eb341a0eba3f654a4b9 Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Fri, 11 Oct 2024 20:58:59 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20v-access=E7=B1=BB=E5=9E=8B=E6=A0=87?= =?UTF-8?q?=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 4 +++- apps/web-antd/types/directive.d.ts | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 apps/web-antd/types/directive.d.ts diff --git a/.vscode/settings.json b/.vscode/settings.json index 0cbfa452..ece7b1f2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -222,5 +222,7 @@ "vitest.disableWorkspaceWarning": true, "cSpell.words": ["tinymce"], "typescript.tsdk": "node_modules/typescript/lib", - "editor.linkedEditing": true // 自动同步更改html标签 + "editor.linkedEditing": true, // 自动同步更改html标签, + "vscodeCustomCodeColor.highlightValue": "v-access", // v-access显示的颜色 + "vscodeCustomCodeColor.highlightValueColor": "#CCFFFF" } diff --git a/apps/web-antd/types/directive.d.ts b/apps/web-antd/types/directive.d.ts new file mode 100644 index 00000000..c2a6ff76 --- /dev/null +++ b/apps/web-antd/types/directive.d.ts @@ -0,0 +1,12 @@ +import type { Directive } from 'vue'; + +declare module 'vue' { + export interface ComponentCustomProperties { + /** + * 判断权限: v-access:code="" + * 判断角色 v-access:role="" + * TODO: 泛型第四个函数为code或role 不生效 + */ + vAccess: Directive; + } +}