refactor: 重命名 CRUD 组件为 Crud 并简化字典标签类型
- CURD 组件 PageModal、PageSearch、PageContent、usePage 重命名为 CrudModal、CrudSearch、CrudTable、useCrudPage - 字典项标签类型改用 primary/success/warning/danger/info,保留历史单字母值兼容读取 - 字典项页面拆分为独立子组件,移除 GithubCorner 组件 - 新增 icon 工具与 screen 样式 - 新增路由缓存、路由跳转、大屏与表格 CRUD 示例页
This commit is contained in:
@@ -2,7 +2,9 @@ import type { App } from "vue";
|
||||
|
||||
import { hasPerm } from "./permission";
|
||||
|
||||
// 全局注册 directive
|
||||
/**
|
||||
* 全局注册 directive
|
||||
*/
|
||||
export function setupDirective(app: App<Element>) {
|
||||
// 使 v-hasPerm 在所有组件中都可用
|
||||
app.directive("hasPerm", hasPerm);
|
||||
|
||||
@@ -7,6 +7,9 @@ import { hasPerm as hasPermFn } from "@/utils/auth";
|
||||
* 按钮权限(复用 utils/auth 的 hasPerm 函数,保持指令与函数行为一致)
|
||||
*/
|
||||
export const hasPerm: Directive = {
|
||||
/**
|
||||
* 挂载时校验按钮权限,无权限则移除元素
|
||||
*/
|
||||
mounted(el: HTMLElement, binding: DirectiveBinding) {
|
||||
const requiredPerms = binding.value;
|
||||
|
||||
@@ -28,6 +31,9 @@ export const hasPerm: Directive = {
|
||||
* 角色权限指令
|
||||
*/
|
||||
export const hasRole: Directive = {
|
||||
/**
|
||||
* 挂载时校验角色权限,无权限则移除元素
|
||||
*/
|
||||
mounted(el: HTMLElement, binding: DirectiveBinding) {
|
||||
const requiredRoles = binding.value;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user