This commit is contained in:
xzh
2025-07-22 20:52:01 +08:00
commit 6350f50c02
1803 changed files with 238412 additions and 0 deletions

20
packages/types/README.md Normal file
View File

@@ -0,0 +1,20 @@
# @vben/types
用于多个 `app` 公用的工具类型,继承了 `@vben-core/typings` 的所有能力。业务上有通用的类型定义可以放在这里。
## 用法
### 添加依赖
```bash
# 进入目标应用目录,例如 apps/xxxx-app
# cd apps/xxxx-app
pnpm add @vben/types
```
### 使用
```ts
// 推荐加上 type
import type { SelectOption } from '@vben/types';
```

44
packages/types/global.d.ts vendored Normal file
View File

@@ -0,0 +1,44 @@
import type { RouteMeta as IRouteMeta } from '@vben-core/typings';
import 'vue-router';
declare module 'vue-router' {
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
interface RouteMeta extends IRouteMeta {}
}
export interface VbenAdminProAppConfigRaw {
// 后端接口地址
VITE_GLOB_API_URL: string;
// 客户端ID
VITE_GLOB_APP_CLIENT_ID: string;
// # 全局加密开关(即开启了加解密功能才会生效 不是全部接口加密 需要和后端对应)
VITE_GLOB_ENABLE_ENCRYPT: string;
// RSA请求解密私钥
VITE_GLOB_RSA_PRIVATE_KEY: string;
// RSA请求加密公钥
VITE_GLOB_RSA_PUBLIC_KEY: string;
// 是否开启sse 注意从配置文件获取的类型为string
VITE_GLOB_SSE_ENABLE: string;
}
export interface ApplicationConfig {
// 后端接口地址
apiURL: string;
// 客户端key
clientId: string;
// 全局加密开关(即开启了加解密功能才会生效 不是全部接口加密 需要和后端对应)
enableEncrypt: boolean;
// RSA响应解密私钥
rsaPrivateKey: string;
// RSA请求加密公钥
rsaPublicKey: string;
// 是否开启sse
sseEnable: boolean;
}
declare global {
interface Window {
_VBEN_ADMIN_PRO_APP_CONF_: VbenAdminProAppConfigRaw;
}
}

View File

@@ -0,0 +1,27 @@
{
"name": "@vben/types",
"version": "5.5.7",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {
"type": "git",
"url": "git+https://github.com/vbenjs/vue-vben-admin.git",
"directory": "packages/types"
},
"license": "MIT",
"type": "module",
"exports": {
".": {
"types": "./src/index.ts",
"default": "./src/index.ts"
},
"./global": {
"types": "./global.d.ts"
}
},
"dependencies": {
"@vben-core/typings": "workspace:*",
"vue": "catalog:",
"vue-router": "catalog:"
}
}

View File

@@ -0,0 +1,2 @@
export type * from './user';
export type * from '@vben-core/typings';

View File

@@ -0,0 +1,11 @@
import type { BasicUserInfo } from '@vben-core/typings';
/** 用户信息 */
interface UserInfo extends BasicUserInfo {
/**
* 拓展使用
*/
[key: string]: any;
}
export type { UserInfo };

View File

@@ -0,0 +1,6 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@vben/tsconfig/web.json",
"include": ["src"],
"exclude": ["node_modules"]
}