first commit
This commit is contained in:
20
packages/types/README.md
Normal file
20
packages/types/README.md
Normal 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';
|
||||
```
|
||||
22
packages/types/global.d.ts
vendored
Normal file
22
packages/types/global.d.ts
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
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;
|
||||
}
|
||||
|
||||
export interface ApplicationConfig {
|
||||
apiURL: string;
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
_VBEN_ADMIN_PRO_APP_CONF_: VbenAdminProAppConfigRaw;
|
||||
}
|
||||
}
|
||||
27
packages/types/package.json
Normal file
27
packages/types/package.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "@vben/types",
|
||||
"version": "5.5.4",
|
||||
"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:"
|
||||
}
|
||||
}
|
||||
2
packages/types/src/index.ts
Normal file
2
packages/types/src/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export type * from './user';
|
||||
export type * from '@vben-core/typings';
|
||||
20
packages/types/src/user.ts
Normal file
20
packages/types/src/user.ts
Normal file
@@ -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 };
|
||||
6
packages/types/tsconfig.json
Normal file
6
packages/types/tsconfig.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"extends": "@vben/tsconfig/web.json",
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
Reference in New Issue
Block a user