6 changed files with 109 additions and 0 deletions
@ -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'; |
||||
|
``` |
||||
@ -0,0 +1,34 @@ |
|||||
|
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; |
||||
|
VITE_GLOB_JAVA_API_URL: string; |
||||
|
VITE_GLOB_AUTH_DINGDING_CLIENT_ID: string; |
||||
|
VITE_GLOB_AUTH_DINGDING_CORP_ID: string; |
||||
|
} |
||||
|
|
||||
|
interface AuthConfig { |
||||
|
dingding?: { |
||||
|
clientId: string; |
||||
|
corpId: string; |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
export interface ApplicationConfig { |
||||
|
apiURL: string; |
||||
|
javaURL: string; |
||||
|
auth: AuthConfig; |
||||
|
} |
||||
|
|
||||
|
declare global { |
||||
|
interface Window { |
||||
|
_VBEN_ADMIN_PRO_APP_CONF_: VbenAdminProAppConfigRaw; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,27 @@ |
|||||
|
{ |
||||
|
"name": "@vben/types", |
||||
|
"version": "5.6.0", |
||||
|
"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:" |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,2 @@ |
|||||
|
export type * from './user'; |
||||
|
export type * from '@vben-core/typings'; |
||||
@ -0,0 +1,20 @@ |
|||||
|
import type { BasicUserInfo } from '@vben-core/typings'; |
||||
|
|
||||
|
/** 用户信息 */ |
||||
|
interface UserInfo extends BasicUserInfo { |
||||
|
/** |
||||
|
* 用户描述 |
||||
|
*/ |
||||
|
desc: string; |
||||
|
/** |
||||
|
* 首页地址 |
||||
|
*/ |
||||
|
homePath: string; |
||||
|
|
||||
|
/** |
||||
|
* accessToken |
||||
|
*/ |
||||
|
token: string; |
||||
|
} |
||||
|
|
||||
|
export type { UserInfo }; |
||||
@ -0,0 +1,6 @@ |
|||||
|
{ |
||||
|
"$schema": "https://json.schemastore.org/tsconfig", |
||||
|
"extends": "@vben/tsconfig/web.json", |
||||
|
"include": ["src"], |
||||
|
"exclude": ["node_modules"] |
||||
|
} |
||||
Loading…
Reference in new issue