Files
MrleeAdmin/app/types/permission.d.ts
T

29 lines
593 B
TypeScript
Raw Normal View History

2026-04-07 11:01:11 +08:00
import type { ComponentCustomProperties } from 'vue'
/**
* 扩展 Vue 实例类型,添加权限相关方法
*/
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
/**
* 检查用户是否有权限
* @param permissions 权限码或权限码数组
* @returns 是否有权限
*/
$hasAuth: (permissions: string | string[]) => boolean
}
}
/**
* 权限指令类型
*/
declare module 'vue' {
interface GlobalDirectives {
auth: typeof import('~/plugins/permission').authDirective
}
}
/**
* 导出权限相关类型
*/
export {}