create-bubbles 0.1.24 → 0.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +15 -0
- package/package.json +1 -2
- package/template-nextjs-vinext-eslint/Dockerfile +4 -4
- package/template-nextjs-vinext-eslint/README.md +6 -2
- package/template-nextjs-vinext-eslint/docker-compose.yaml +4 -4
- package/template-nextjs-vinext-eslint/eslint.config.js +2 -0
- package/template-nextjs-vinext-eslint/package.json +28 -26
- package/template-nextjs-vinext-eslint/pnpm-workspace.yaml +13 -1
- package/template-nextjs-vinext-eslint/src/utils/request/core/index.ts +63 -45
- package/template-nextjs-vinext-eslint/src/utils/request/core/utils.ts +12 -6
- package/template-nextjs-vinext-eslint/vite.config.ts +1 -1
- package/template-react-rsbuild-biome/.agents/rules/SVG/344/275/277/347/224/250.md +8 -0
- package/template-react-rsbuild-biome/AGENTS.md +11 -0
- package/template-react-rsbuild-biome/index.html +2 -2
- package/template-react-rsbuild-biome/package.json +25 -24
- package/template-react-rsbuild-biome/pnpm-workspace.yaml +5 -0
- package/template-react-rsbuild-biome/rsbuild.config.ts +1 -1
- package/template-react-rsbuild-biome/src/assets/icon/logo.svg +1 -1
- package/template-react-rsbuild-biome/src/assets/svg/draft.svg +4 -0
- package/template-react-rsbuild-biome/src/components/Icon/svg-icon/README.md +37 -0
- package/template-react-rsbuild-biome/src/components/Icon/svg-icon/SvgIcon.tsx +27 -0
- package/template-react-rsbuild-biome/src/env.d.ts +7 -0
- package/template-react-rsbuild-biome/src/utils/request/index.ts +3 -4
- package/template-react-rsbuild-biome/tsconfig.json +1 -2
- package/template-taro-react-oxc/.oxlintrc.json +0 -1
- package/template-taro-react-oxc/package.json +53 -52
- package/template-taro-react-oxc/pnpm-workspace.yaml +46 -0
- package/template-taro-vue-eslint/package.json +56 -56
- package/template-vp-monorepo-react-hono/apps/web/.agents/rules/SVG/344/275/277/347/224/250.md +8 -0
- package/template-vp-monorepo-react-hono/apps/web/AGENTS.md +11 -0
- package/template-vp-monorepo-react-hono/apps/web/package.json +1 -0
- package/template-vp-monorepo-react-hono/apps/web/src/assets/svg/draft.svg +4 -0
- package/template-vp-monorepo-react-hono/apps/web/src/components/Icon/svg-icon/README.md +37 -0
- package/template-vp-monorepo-react-hono/apps/web/src/components/Icon/svg-icon/SvgIcon.tsx +27 -0
- package/template-vp-monorepo-react-hono/apps/web/tsconfig.json +1 -1
- package/template-vp-monorepo-react-hono/apps/web/vite.config.ts +2 -0
- package/template-vp-monorepo-react-hono/pnpm-workspace.yaml +1 -0
- package/template-vp-monorepo-react-nestjs/.agents/rules//344/273/243/347/240/201/350/256/276/350/256/241.md +4 -0
- package/template-vp-monorepo-react-nestjs/.agents/rules//345/205/261/344/272/253/344/273/243/347/240/201.md +4 -0
- package/template-vp-monorepo-react-nestjs/.spaces/01./344/274/201/344/270/232/347/272/247/351/241/271/347/233/256/347/272/247//351/234/200/346/261/202/346/226/207/346/241/243.md +177 -0
- package/template-vp-monorepo-react-nestjs/.spaces/server/04.upload.md +4504 -0
- package/template-vp-monorepo-react-nestjs/.spaces/server/05./344/270/212/344/274/240/346/224/271/351/200/240/346/226/271/346/241/210/README.md +858 -0
- package/template-vp-monorepo-react-nestjs/.spaces/server/06./345/205/254/345/205/261/351/230/237/345/210/227/346/216/245/345/205/245/346/226/271/346/241/210/README.md +1890 -0
- package/template-vp-monorepo-react-nestjs/.spaces/server/06./345/205/254/345/205/261/351/230/237/345/210/227/346/216/245/345/205/245/346/226/271/346/241/210//344/270/212/344/274/240/346/270/205/347/220/206.md +1465 -0
- package/template-vp-monorepo-react-nestjs/AGENTS.md +8 -12
- package/template-vp-monorepo-react-nestjs/apps/server/.agents/rules/error-handling.md +84 -0
- package/template-vp-monorepo-react-nestjs/apps/server/.env.development +60 -0
- package/template-vp-monorepo-react-nestjs/apps/server/.env.production +16 -0
- package/template-vp-monorepo-react-nestjs/apps/server/AGENTS.md +9 -0
- package/template-vp-monorepo-react-nestjs/apps/server/drizzle/0000_military_colonel_america.sql +11 -0
- package/template-vp-monorepo-react-nestjs/apps/server/drizzle/0001_loud_siren.sql +27 -0
- package/template-vp-monorepo-react-nestjs/apps/server/drizzle/meta/0000_snapshot.json +97 -0
- package/template-vp-monorepo-react-nestjs/apps/server/drizzle/meta/0001_snapshot.json +354 -0
- package/template-vp-monorepo-react-nestjs/apps/server/drizzle/meta/_journal.json +20 -0
- package/template-vp-monorepo-react-nestjs/apps/server/package.json +4 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/app.module.ts +14 -2
- package/template-vp-monorepo-react-nestjs/apps/server/src/common/adapters/fastify.adapter.ts +6 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/config/index.ts +2 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/config/queue.config.ts +105 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/config/storage.config.ts +33 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/database/schema.ts +57 -1
- package/template-vp-monorepo-react-nestjs/apps/server/src/main.ts +1 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/auth/auth.service.ts +1 -3
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/auth/dto/auth-repsponse.dto.ts +2 -2
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/task-queue/queue-worker.bootstrap.ts +24 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/task-queue/task-queue.constants.ts +24 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/task-queue/task-queue.contracts.ts +35 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/task-queue/task-queue.module.ts +56 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/task-queue/task-queue.processor.ts +62 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/task-queue/task-queue.service.ts +58 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/test/error-catelog.spec.ts +34 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/upload/dto/initiate-mutipart-upload.dto.ts +26 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/upload/dto/upload-params.dto.ts +15 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/upload/storage/exact-size.transform.ts +66 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/upload/storage/minio-storage.adapter.ts +239 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/upload/storage/storage.port.ts +61 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/upload/upload.constants.ts +23 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/upload/upload.controller.ts +109 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/upload/upload.errors.ts +80 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/upload/upload.module.ts +20 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/upload/upload.reponsitory.ts +166 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/upload/upload.service.ts +696 -0
- package/template-vp-monorepo-react-nestjs/apps/server/src/modules/upload/utils/object-key.ts +10 -0
- package/template-vp-monorepo-react-nestjs/apps/server/test/task-queue.integration.spec.ts +120 -0
- package/template-vp-monorepo-react-nestjs/apps/server/test/task-queue.processor.spec.ts +63 -0
- package/template-vp-monorepo-react-nestjs/apps/server/test/task-queue.service.spec.ts +106 -0
- package/template-vp-monorepo-react-nestjs/apps/web/.agents/rules/SVG/344/275/277/347/224/250.md +8 -0
- package/template-vp-monorepo-react-nestjs/apps/web/.agents/rules//345/274/271/347/252/227/347/273/204/344/273/266.md +4 -0
- package/template-vp-monorepo-react-nestjs/apps/web/.agents/rules//346/226/207/344/273/266/346/213/206/345/210/206.md +4 -0
- package/template-vp-monorepo-react-nestjs/apps/web/.agents/rules//347/273/204/344/273/266/345/221/275/345/220/215.md +3 -0
- package/template-vp-monorepo-react-nestjs/apps/web/.agents/rules//350/241/250/346/240/274/351/241/265/351/235/242.md +11 -0
- package/template-vp-monorepo-react-nestjs/apps/web/.agents/rules//351/241/265/351/235/242/346/216/245/345/217/243.md +3 -0
- package/template-vp-monorepo-react-nestjs/apps/web/.env.dev +1 -1
- package/template-vp-monorepo-react-nestjs/apps/web/AGENTS.md +16 -0
- package/template-vp-monorepo-react-nestjs/apps/web/README.MD +153 -0
- package/template-vp-monorepo-react-nestjs/apps/web/index.html +3 -2
- package/template-vp-monorepo-react-nestjs/apps/web/package.json +6 -1
- package/template-vp-monorepo-react-nestjs/apps/web/public/favicon.svg +9 -1
- package/template-vp-monorepo-react-nestjs/apps/web/src/App.module.css +5 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/App.tsx +16 -9
- package/template-vp-monorepo-react-nestjs/apps/web/src/api/auth.ts +9 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/assets/svg/draft.svg +4 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/components/DraftProTable/DraftProTable.module.css +78 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/components/DraftProTable/DraftProTable.tsx +99 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/components/DraftProTable/README.md +34 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/components/FullHeightProTable/FullHeightProTable.module.css +54 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/components/FullHeightProTable/FullHeightProTable.tsx +41 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/components/Icon/svg-icon/README.md +37 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/components/Icon/svg-icon/SvgIcon.tsx +27 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/components/Loading/PageLoading.module.css +7 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/components/Loading/PageLoading.tsx +2 -1
- package/template-vp-monorepo-react-nestjs/apps/web/src/config/theme.ts +20 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/layouts/BasicLayout.module.css +17 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/layouts/BasicLayout.tsx +106 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/examples/i18n/index.module.css +23 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/examples/i18n/index.tsx +53 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/examples/pro-table/components/ProjectFormDialog.tsx +132 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/examples/pro-table/config/columns.tsx +121 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/examples/pro-table/config/index.ts +77 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/examples/pro-table/draft/components/DraftProjectFormDialog.tsx +140 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/examples/pro-table/draft/config/columns.tsx +127 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/examples/pro-table/draft/config/index.ts +39 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/examples/pro-table/draft/config/projects.ts +48 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/examples/pro-table/draft/index.module.css +49 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/examples/pro-table/draft/index.tsx +163 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/examples/pro-table/index.module.css +53 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/examples/pro-table/index.tsx +135 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/home/index.module.css +23 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/home/index.tsx +26 -43
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/login/api.ts +11 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/login/index.tsx +183 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/login/login.css +164 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/router/index.tsx +36 -12
- package/template-vp-monorepo-react-nestjs/apps/web/src/styles/index.css +11 -4
- package/template-vp-monorepo-react-nestjs/apps/web/src/utils/request/core/index.ts +55 -47
- package/template-vp-monorepo-react-nestjs/apps/web/src/utils/request/index.ts +10 -5
- package/template-vp-monorepo-react-nestjs/apps/web/src/utils/storage/cookie.ts +50 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/utils/storage/session.ts +33 -0
- package/template-vp-monorepo-react-nestjs/apps/web/test/draft-projects.spec.ts +89 -0
- package/template-vp-monorepo-react-nestjs/apps/web/test/request.spec.ts +145 -0
- package/template-vp-monorepo-react-nestjs/apps/web/test/storage.spec.ts +108 -0
- package/template-vp-monorepo-react-nestjs/apps/web/test/tsconfig.json +7 -0
- package/template-vp-monorepo-react-nestjs/apps/web/tsconfig.json +1 -1
- package/template-vp-monorepo-react-nestjs/apps/web/vite.config.ts +7 -0
- package/template-vp-monorepo-react-nestjs/apps/web-vue/tsconfig.tsbuildinfo +1 -0
- package/template-vp-monorepo-react-nestjs/docker-compose.yml +19 -0
- package/template-vp-monorepo-react-nestjs/mise.toml +1 -1
- package/template-vp-monorepo-react-nestjs/package.json +1 -6
- package/template-vp-monorepo-react-nestjs/pnpm-workspace.yaml +9 -1
- package/template-vp-react/.agents/rules/SVG/344/275/277/347/224/250.md +8 -0
- package/template-vp-react/AGENTS.md +11 -0
- package/template-vp-react/commitlint.config.js +0 -0
- package/template-vp-react/package.json +21 -26
- package/template-vp-react/pnpm-workspace.yaml +6 -0
- package/template-vp-react/src/assets/svg/draft.svg +4 -0
- package/template-vp-react/src/components/Icon/svg-icon/README.md +37 -0
- package/template-vp-react/src/components/Icon/svg-icon/SvgIcon.tsx +27 -0
- package/template-vp-react/src/utils/request/index.ts +18 -5
- package/template-vp-react/tsconfig.json +2 -3
- package/template-vp-react/vite.config.ts +2 -0
- package/template-vp-react-shadcn/.agents/rules/SVG/344/275/277/347/224/250.md +8 -0
- package/template-vp-react-shadcn/.vscode/settings.json +2 -2
- package/template-vp-react-shadcn/{agents.md → AGENTS.md} +12 -2
- package/template-vp-react-shadcn/README.md +41 -0
- package/template-vp-react-shadcn/commitlint.config.js +1 -1
- package/template-vp-react-shadcn/components.json +1 -1
- package/template-vp-react-shadcn/package.json +25 -32
- package/template-vp-react-shadcn/pnpm-workspace.yaml +10 -0
- package/template-vp-react-shadcn/src/App.tsx +10 -10
- package/template-vp-react-shadcn/src/assets/svg/draft.svg +4 -0
- package/template-vp-react-shadcn/src/components/Icon/svg-icon/README.md +37 -0
- package/template-vp-react-shadcn/src/components/Icon/svg-icon/SvgIcon.tsx +27 -0
- package/template-vp-react-shadcn/src/components/Loading/PageLoading.tsx +4 -4
- package/template-vp-react-shadcn/src/components/Player/VideoJS/index.tsx +94 -78
- package/template-vp-react-shadcn/src/components/Player/index.ts +1 -1
- package/template-vp-react-shadcn/src/components/ui/button.tsx +25 -32
- package/template-vp-react-shadcn/src/components/ui/spinner.tsx +8 -7
- package/template-vp-react-shadcn/src/components/ui/toast.tsx +229 -0
- package/template-vp-react-shadcn/src/lib/utils.ts +3 -3
- package/template-vp-react-shadcn/src/main.tsx +5 -4
- package/template-vp-react-shadcn/src/pages/home/index.tsx +43 -35
- package/template-vp-react-shadcn/src/router/index.tsx +15 -15
- package/template-vp-react-shadcn/src/styles/index.css +4 -4
- package/template-vp-react-shadcn/src/styles/shadcn.css +2 -2
- package/template-vp-react-shadcn/src/utils/env/index.tsx +2 -2
- package/template-vp-react-shadcn/src/utils/request/alova-core/index.ts +102 -30
- package/template-vp-react-shadcn/src/utils/request/alova-core/utils.ts +5 -2
- package/template-vp-react-shadcn/src/utils/request/index.ts +32 -19
- package/template-vp-react-shadcn/src/utils/request/readme.md +41 -38
- package/template-vp-react-shadcn/tsconfig.json +2 -3
- package/template-vp-react-shadcn/vite.config.ts +29 -15
- package/template-vp-vue-eslint-vapor/package.json +26 -33
- package/template-vp-vue-eslint-vapor/pnpm-workspace.yaml +29 -1
- package/template-vue-vp-eslint/README.md +3 -10
- package/template-vue-vp-eslint/package.json +27 -34
- package/template-vue-vp-eslint/pnpm-workspace.yaml +27 -2
- package/template-vue-vp-eslint/src/layout/default/index.vue +4 -3
- package/dist/index.mjs +0 -422
- package/template-vp-monorepo-react-nestjs/.agents/auth.config.ts +0 -0
- package/template-vp-monorepo-react-nestjs/.spaces/server/todo.md +0 -991
- package/template-vp-monorepo-react-nestjs/apps/server/README.md +0 -3
- package/template-vp-react-shadcn/.oxfmtrc.jsonc +0 -8
- package/template-vp-react-shadcn/.oxlintrc.jsonc +0 -3
- package/template-vp-react-shadcn/src/components/ui/sonner.tsx +0 -43
|
@@ -7,34 +7,37 @@
|
|
|
7
7
|
请求方法会创建 alova `Method` 实例,不会在创建时立刻发送请求。可以在组件中交给 `useRequest`,也可以在普通函数里直接 `await`。
|
|
8
8
|
|
|
9
9
|
```ts
|
|
10
|
-
import alovaRequest from
|
|
10
|
+
import alovaRequest from '@/utils/request'
|
|
11
11
|
|
|
12
12
|
interface DramaItem {
|
|
13
|
-
id: number
|
|
14
|
-
title: string
|
|
13
|
+
id: number
|
|
14
|
+
title: string
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
interface DramaListParams {
|
|
18
|
-
page: number
|
|
19
|
-
pageSize: number
|
|
18
|
+
page: number
|
|
19
|
+
pageSize: number
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export const getDramaList = (params: DramaListParams) => {
|
|
23
|
-
return alovaRequest.Get<DramaItem[]>(
|
|
24
|
-
}
|
|
23
|
+
return alovaRequest.Get<DramaItem[]>('/drama/list', { params })
|
|
24
|
+
}
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
组件中使用:
|
|
28
28
|
|
|
29
29
|
```tsx
|
|
30
|
-
import { useRequest } from
|
|
30
|
+
import { useRequest } from 'alova/client'
|
|
31
31
|
|
|
32
|
-
import { getDramaList } from
|
|
32
|
+
import { getDramaList } from '@/api'
|
|
33
33
|
|
|
34
34
|
export function DramaList() {
|
|
35
|
-
const { data, loading, error } = useRequest(
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
const { data, loading, error } = useRequest(
|
|
36
|
+
getDramaList({ page: 1, pageSize: 20 }),
|
|
37
|
+
{
|
|
38
|
+
initialData: [],
|
|
39
|
+
},
|
|
40
|
+
)
|
|
38
41
|
|
|
39
42
|
// ...
|
|
40
43
|
}
|
|
@@ -43,7 +46,7 @@ export function DramaList() {
|
|
|
43
46
|
普通异步函数中使用:
|
|
44
47
|
|
|
45
48
|
```ts
|
|
46
|
-
const list = await getDramaList({ page: 1, pageSize: 20 })
|
|
49
|
+
const list = await getDramaList({ page: 1, pageSize: 20 })
|
|
47
50
|
```
|
|
48
51
|
|
|
49
52
|
## 请求参数
|
|
@@ -51,29 +54,29 @@ const list = await getDramaList({ page: 1, pageSize: 20 });
|
|
|
51
54
|
GET 查询参数放在第二个参数的 `params` 里:
|
|
52
55
|
|
|
53
56
|
```ts
|
|
54
|
-
alovaRequest.Get<UserInfo>(
|
|
57
|
+
alovaRequest.Get<UserInfo>('/user/detail', {
|
|
55
58
|
params: {
|
|
56
59
|
id: 1,
|
|
57
60
|
},
|
|
58
|
-
})
|
|
61
|
+
})
|
|
59
62
|
```
|
|
60
63
|
|
|
61
64
|
POST、PUT、PATCH、DELETE 的 body 放在第二个参数,配置放在第三个参数:
|
|
62
65
|
|
|
63
66
|
```ts
|
|
64
|
-
alovaRequest.Post<CreateUserResult>(
|
|
65
|
-
name:
|
|
66
|
-
})
|
|
67
|
+
alovaRequest.Post<CreateUserResult>('/user/create', {
|
|
68
|
+
name: 'Tom',
|
|
69
|
+
})
|
|
67
70
|
|
|
68
71
|
alovaRequest.Post<CreateUserResult>(
|
|
69
|
-
|
|
70
|
-
{ name:
|
|
72
|
+
'/user/create',
|
|
73
|
+
{ name: 'Tom' },
|
|
71
74
|
{
|
|
72
75
|
meta: {
|
|
73
76
|
isShowSuccessMessage: true,
|
|
74
77
|
},
|
|
75
78
|
},
|
|
76
|
-
)
|
|
79
|
+
)
|
|
77
80
|
```
|
|
78
81
|
|
|
79
82
|
## 返回结构
|
|
@@ -82,9 +85,9 @@ alovaRequest.Post<CreateUserResult>(
|
|
|
82
85
|
|
|
83
86
|
```ts
|
|
84
87
|
interface ApiResponse<T> {
|
|
85
|
-
code: number
|
|
86
|
-
data: T
|
|
87
|
-
msg: string
|
|
88
|
+
code: number
|
|
89
|
+
data: T
|
|
90
|
+
msg: string
|
|
88
91
|
}
|
|
89
92
|
```
|
|
90
93
|
|
|
@@ -101,15 +104,15 @@ interface ApiResponse<T> {
|
|
|
101
104
|
|
|
102
105
|
```ts
|
|
103
106
|
alovaRequest.Post(
|
|
104
|
-
|
|
105
|
-
{ id: 1, name:
|
|
107
|
+
'/user/update',
|
|
108
|
+
{ id: 1, name: 'Tom' },
|
|
106
109
|
{
|
|
107
110
|
meta: {
|
|
108
111
|
isShowSuccessMessage: true,
|
|
109
112
|
isShowErrorMessage: false,
|
|
110
113
|
},
|
|
111
114
|
},
|
|
112
|
-
)
|
|
115
|
+
)
|
|
113
116
|
```
|
|
114
117
|
|
|
115
118
|
也可以创建一个带临时配置的请求实例:
|
|
@@ -117,11 +120,11 @@ alovaRequest.Post(
|
|
|
117
120
|
```ts
|
|
118
121
|
const silentRequest = alovaRequest({
|
|
119
122
|
isShowErrorMessage: false,
|
|
120
|
-
})
|
|
123
|
+
})
|
|
121
124
|
|
|
122
|
-
silentRequest.Get<UserInfo>(
|
|
125
|
+
silentRequest.Get<UserInfo>('/user/detail', {
|
|
123
126
|
params: { id: 1 },
|
|
124
|
-
})
|
|
127
|
+
})
|
|
125
128
|
```
|
|
126
129
|
|
|
127
130
|
## 原始响应
|
|
@@ -130,15 +133,15 @@ silentRequest.Get<UserInfo>("/user/detail", {
|
|
|
130
133
|
|
|
131
134
|
```ts
|
|
132
135
|
const downloadFile = () => {
|
|
133
|
-
return alovaRequest.Get<Response>(
|
|
136
|
+
return alovaRequest.Get<Response>('/file/download', {
|
|
134
137
|
meta: {
|
|
135
138
|
isTransformResponse: false,
|
|
136
139
|
},
|
|
137
|
-
})
|
|
138
|
-
}
|
|
140
|
+
})
|
|
141
|
+
}
|
|
139
142
|
|
|
140
|
-
const response = await downloadFile()
|
|
141
|
-
const blob = await response.blob()
|
|
143
|
+
const response = await downloadFile()
|
|
144
|
+
const blob = await response.blob()
|
|
142
145
|
```
|
|
143
146
|
|
|
144
147
|
## 错误处理
|
|
@@ -146,13 +149,13 @@ const blob = await response.blob();
|
|
|
146
149
|
HTTP 状态码错误、业务 `code` 错误都会抛出 `RequestError`,alova hook 会进入 `error` 分支。
|
|
147
150
|
|
|
148
151
|
```ts
|
|
149
|
-
import { RequestError } from
|
|
152
|
+
import { RequestError } from '@/utils/request/alova-core'
|
|
150
153
|
|
|
151
154
|
try {
|
|
152
|
-
await getDramaList({ page: 1, pageSize: 20 })
|
|
155
|
+
await getDramaList({ page: 1, pageSize: 20 })
|
|
153
156
|
} catch (error) {
|
|
154
157
|
if (error instanceof RequestError) {
|
|
155
|
-
console.log(error.status, error.code, error.message)
|
|
158
|
+
console.log(error.status, error.code, error.message)
|
|
156
159
|
}
|
|
157
160
|
}
|
|
158
161
|
```
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"useDefineForClassFields": true,
|
|
5
5
|
"module": "ESNext",
|
|
6
6
|
"lib": ["ES2023", "DOM", "DOM.Iterable"],
|
|
7
|
-
"types": ["vite/client"],
|
|
7
|
+
"types": ["vite/client", "vite-plugin-svgr/client"],
|
|
8
8
|
"skipLibCheck": true,
|
|
9
9
|
|
|
10
10
|
/* Bundler mode */
|
|
@@ -23,9 +23,8 @@
|
|
|
23
23
|
"noFallthroughCasesInSwitch": true,
|
|
24
24
|
"noUncheckedSideEffectImports": true,
|
|
25
25
|
|
|
26
|
-
"baseUrl": ".",
|
|
27
26
|
"paths": {
|
|
28
|
-
"@/*": ["src/*"]
|
|
27
|
+
"@/*": ["./src/*"]
|
|
29
28
|
}
|
|
30
29
|
},
|
|
31
30
|
"include": ["src"]
|
|
@@ -1,35 +1,49 @@
|
|
|
1
|
-
import path from
|
|
1
|
+
import path from 'path'
|
|
2
2
|
|
|
3
|
-
import tailwindcss from
|
|
4
|
-
import react from
|
|
5
|
-
import AutoImport from
|
|
6
|
-
import
|
|
3
|
+
import tailwindcss from '@tailwindcss/vite'
|
|
4
|
+
import react from '@vitejs/plugin-react'
|
|
5
|
+
import AutoImport from 'unplugin-auto-import/vite'
|
|
6
|
+
import svgr from 'vite-plugin-svgr'
|
|
7
|
+
import { defineConfig, loadEnv } from 'vite-plus'
|
|
7
8
|
|
|
8
9
|
export default defineConfig(({ mode }) => {
|
|
9
|
-
const root = process.cwd()
|
|
10
|
-
const env = loadEnv(mode, root)
|
|
11
|
-
const { VITE_PORT } = env
|
|
10
|
+
const root = process.cwd()
|
|
11
|
+
const env = loadEnv(mode, root)
|
|
12
|
+
const { VITE_PORT } = env
|
|
12
13
|
|
|
13
14
|
return {
|
|
15
|
+
fmt: {
|
|
16
|
+
printWidth: 80,
|
|
17
|
+
semi: false,
|
|
18
|
+
singleQuote: true,
|
|
19
|
+
sortImports: {},
|
|
20
|
+
sortTailwindcss: {},
|
|
21
|
+
sortPackageJson: true,
|
|
22
|
+
ignorePatterns: ['.agents/skills/**', 'skills-lock.json', 'src/types/auto-imports.d.ts'],
|
|
23
|
+
},
|
|
24
|
+
lint: {
|
|
25
|
+
plugins: ['import', 'jsdoc', 'promise', 'react', 'react-perf', 'jsx-a11y'],
|
|
26
|
+
},
|
|
14
27
|
resolve: {
|
|
15
28
|
alias: {
|
|
16
|
-
|
|
29
|
+
'@': path.resolve(__dirname, 'src'),
|
|
17
30
|
},
|
|
18
31
|
},
|
|
19
32
|
server: {
|
|
20
33
|
port: Number(VITE_PORT),
|
|
21
|
-
host:
|
|
34
|
+
host: '0.0.0.0',
|
|
22
35
|
},
|
|
23
36
|
plugins: [
|
|
24
37
|
react(),
|
|
38
|
+
svgr({ svgrOptions: { icon: true, ref: true } }),
|
|
25
39
|
AutoImport({
|
|
26
|
-
imports: [
|
|
27
|
-
dts:
|
|
40
|
+
imports: ['react', 'react-router', 'react-dom'],
|
|
41
|
+
dts: './src/types/auto-imports.d.ts',
|
|
28
42
|
}),
|
|
29
43
|
tailwindcss(),
|
|
30
44
|
],
|
|
31
45
|
staged: {
|
|
32
|
-
|
|
46
|
+
'*': 'vp check --fix',
|
|
33
47
|
},
|
|
34
|
-
}
|
|
35
|
-
})
|
|
48
|
+
}
|
|
49
|
+
})
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vp dev --mode development",
|
|
8
|
-
"build": "vue-tsc -b
|
|
8
|
+
"build": "vp build && vue-tsc -b",
|
|
9
9
|
"preview": "vp preview",
|
|
10
10
|
"lint": "oxlint && eslint",
|
|
11
11
|
"lint:fix": "oxlint && eslint --fix",
|
|
@@ -13,52 +13,45 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@alova/adapter-axios": "^2.0.20",
|
|
16
|
-
"@antdv-next/icons": "^1.1.
|
|
17
|
-
"alova": "^3.5.
|
|
18
|
-
"antdv-next": "^1.
|
|
19
|
-
"axios": "^1.
|
|
20
|
-
"dayjs": "^1.11.
|
|
16
|
+
"@antdv-next/icons": "^1.1.2",
|
|
17
|
+
"alova": "^3.5.5",
|
|
18
|
+
"antdv-next": "^1.5.3",
|
|
19
|
+
"axios": "^1.20.0",
|
|
20
|
+
"dayjs": "^1.11.23",
|
|
21
21
|
"echarts": "^6.1.0",
|
|
22
22
|
"nprogress": "^0.2.0",
|
|
23
|
-
"pinia": "^4.0.
|
|
23
|
+
"pinia": "^4.0.3",
|
|
24
24
|
"pinia-plugin-persistedstate": "^4.7.1",
|
|
25
25
|
"radashi": "^12.9.1",
|
|
26
|
-
"vue": "3.6.0-rc.
|
|
27
|
-
"vue-router": "^5.
|
|
26
|
+
"vue": "3.6.0-rc.7",
|
|
27
|
+
"vue-router": "^5.3.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@antdv-next/auto-import-resolver": "^1.
|
|
31
|
-
"@antfu/eslint-config": "^9.
|
|
32
|
-
"@commitlint/cli": "^21.2.
|
|
33
|
-
"@commitlint/config-conventional": "^21.2.
|
|
34
|
-
"@types/node": "^26.
|
|
30
|
+
"@antdv-next/auto-import-resolver": "^1.2.0",
|
|
31
|
+
"@antfu/eslint-config": "^9.5.1",
|
|
32
|
+
"@commitlint/cli": "^21.2.2",
|
|
33
|
+
"@commitlint/config-conventional": "^21.2.2",
|
|
34
|
+
"@types/node": "^26.5.0",
|
|
35
35
|
"@types/nprogress": "^0.2.3",
|
|
36
|
-
"@unocss/eslint-plugin": "^66.
|
|
37
|
-
"@unocss/preset-attributify": "^66.
|
|
38
|
-
"@unocss/preset-wind4": "^66.
|
|
36
|
+
"@unocss/eslint-plugin": "^66.10.0",
|
|
37
|
+
"@unocss/preset-attributify": "^66.10.0",
|
|
38
|
+
"@unocss/preset-wind4": "^66.10.0",
|
|
39
39
|
"@vitejs/plugin-vue": "^6.0.8",
|
|
40
40
|
"@vue/tsconfig": "^0.9.1",
|
|
41
|
-
"eslint": "10.
|
|
41
|
+
"eslint": "10.10.0",
|
|
42
42
|
"eslint-plugin-format": "^2.0.1",
|
|
43
|
-
"eslint-plugin-oxlint": "^1.
|
|
43
|
+
"eslint-plugin-oxlint": "^1.82.0",
|
|
44
44
|
"fast-glob": "^3.3.3",
|
|
45
|
-
"oxlint": "^1.
|
|
46
|
-
"sass": "^1.
|
|
45
|
+
"oxlint": "^1.82.0",
|
|
46
|
+
"sass": "^1.104.0",
|
|
47
47
|
"typescript": "^6.0.3",
|
|
48
|
-
"unocss": "66.
|
|
49
|
-
"unplugin-auto-import": "^21.
|
|
48
|
+
"unocss": "66.10.0",
|
|
49
|
+
"unplugin-auto-import": "^21.1.0",
|
|
50
50
|
"unplugin-vue-components": "^32.1.0",
|
|
51
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@0.
|
|
51
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@0.3.0",
|
|
52
52
|
"vite-plugin-inspect": "^12.0.2",
|
|
53
53
|
"vite-plugin-svg-icons": "^2.0.1",
|
|
54
|
-
"vite-plus": "^0.
|
|
55
|
-
"vue-tsc": "^3.3.
|
|
56
|
-
},
|
|
57
|
-
"devEngines": {
|
|
58
|
-
"packageManager": {
|
|
59
|
-
"name": "pnpm",
|
|
60
|
-
"version": "11.11.0",
|
|
61
|
-
"onFail": "download"
|
|
62
|
-
}
|
|
54
|
+
"vite-plus": "^0.3.0",
|
|
55
|
+
"vue-tsc": "^3.3.11"
|
|
63
56
|
}
|
|
64
57
|
}
|
|
@@ -1,2 +1,30 @@
|
|
|
1
|
+
minimumReleaseAgeExcludePrune: true
|
|
2
|
+
minimumReleaseAgeExclude:
|
|
3
|
+
- '@oxlint/binding-android-arm-eabi@1.82.0'
|
|
4
|
+
- '@oxlint/binding-android-arm64@1.82.0'
|
|
5
|
+
- '@oxlint/binding-darwin-arm64@1.82.0'
|
|
6
|
+
- '@oxlint/binding-darwin-x64@1.82.0'
|
|
7
|
+
- '@oxlint/binding-freebsd-x64@1.82.0'
|
|
8
|
+
- '@oxlint/binding-linux-arm-gnueabihf@1.82.0'
|
|
9
|
+
- '@oxlint/binding-linux-arm-musleabihf@1.82.0'
|
|
10
|
+
- '@oxlint/binding-linux-arm64-gnu@1.82.0'
|
|
11
|
+
- '@oxlint/binding-linux-arm64-musl@1.82.0'
|
|
12
|
+
- '@oxlint/binding-linux-ppc64-gnu@1.82.0'
|
|
13
|
+
- '@oxlint/binding-linux-riscv64-gnu@1.82.0'
|
|
14
|
+
- '@oxlint/binding-linux-riscv64-musl@1.82.0'
|
|
15
|
+
- '@oxlint/binding-linux-s390x-gnu@1.82.0'
|
|
16
|
+
- '@oxlint/binding-linux-x64-gnu@1.82.0'
|
|
17
|
+
- '@oxlint/binding-linux-x64-musl@1.82.0'
|
|
18
|
+
- '@oxlint/binding-openharmony-arm64@1.82.0'
|
|
19
|
+
- '@oxlint/binding-win32-arm64-msvc@1.82.0'
|
|
20
|
+
- '@oxlint/binding-win32-ia32-msvc@1.82.0'
|
|
21
|
+
- '@oxlint/binding-win32-x64-msvc@1.82.0'
|
|
22
|
+
- '@types/node@26.5.0'
|
|
23
|
+
- eslint-plugin-oxlint@1.82.0
|
|
24
|
+
- oxlint@1.82.0
|
|
25
|
+
|
|
26
|
+
trustPolicy: no-downgrade
|
|
27
|
+
shellEmulator: true
|
|
28
|
+
|
|
1
29
|
allowBuilds:
|
|
2
|
-
|
|
30
|
+
'@parcel/watcher': false
|
|
@@ -8,7 +8,7 @@ Vue 3 项目模板,基于 Vite+ 统一工具链,集成 Antdv Next UI 组件
|
|
|
8
8
|
|------|------|------|
|
|
9
9
|
| 构建工具 | Vite+ (`vp`) | 统一工具链,封装 Vite + Rolldown + Oxlint |
|
|
10
10
|
| 框架 | Vue 3 | Composition API + `<script setup>` |
|
|
11
|
-
| 语言 | TypeScript 6
|
|
11
|
+
| 语言 | TypeScript 6 | 兼容 typescript-eslint 和 vue-tsc |
|
|
12
12
|
| UI 组件库 | Antdv Next | 自动按需导入 |
|
|
13
13
|
| 状态管理 | Pinia | 含持久化插件 |
|
|
14
14
|
| 路由 | Vue Router 5 | |
|
|
@@ -80,16 +80,9 @@ src/
|
|
|
80
80
|
| `VITE_API_AFFIX` | API 路由前缀(用于代理) |
|
|
81
81
|
| `VITE_APP_NAME` | 应用名称 |
|
|
82
82
|
|
|
83
|
-
## TypeScript
|
|
83
|
+
## TypeScript 版本说明
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
本项目采用微软官方推荐的并存方案:
|
|
88
|
-
|
|
89
|
-
- `typescript` → 指向 `@typescript/typescript6`(供 ESLint、vue-tsc 使用)
|
|
90
|
-
- `@typescript/native` → 指向 TypeScript 7(可手动调用 `npx @typescript/native tsc`)
|
|
91
|
-
|
|
92
|
-
VS Code 中安装 [TypeScript (Native Preview)](https://marketplace.visualstudio.com/items?itemName=TypeScriptTeam.native-preview) 扩展可享受 TS7 的语言服务加速。
|
|
85
|
+
模板保留 `typescript@^6.0.3`,用于 ESLint 和 `vue-tsc`。TypeScript 7 更换了编译器接口,当前工具链仍依赖 TypeScript 6 的接口,因此暂不升级到 7。
|
|
93
86
|
|
|
94
87
|
## 代码规范
|
|
95
88
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "template-vp-vue-eslint",
|
|
3
|
-
"type": "module",
|
|
4
3
|
"version": "0.0.1",
|
|
5
4
|
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vp dev --mode development",
|
|
8
8
|
"build": "vue-tsc -b && vp build",
|
|
@@ -12,52 +12,45 @@
|
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@alova/adapter-axios": "^2.0.20",
|
|
15
|
-
"@antdv-next/icons": "^1.1.
|
|
16
|
-
"alova": "^3.5.
|
|
17
|
-
"antdv-next": "^1.
|
|
18
|
-
"axios": "^1.
|
|
19
|
-
"dayjs": "^1.11.
|
|
15
|
+
"@antdv-next/icons": "^1.1.2",
|
|
16
|
+
"alova": "^3.5.5",
|
|
17
|
+
"antdv-next": "^1.5.3",
|
|
18
|
+
"axios": "^1.20.0",
|
|
19
|
+
"dayjs": "^1.11.23",
|
|
20
20
|
"echarts": "^6.1.0",
|
|
21
21
|
"nprogress": "^0.2.0",
|
|
22
|
-
"pinia": "^4.0.
|
|
22
|
+
"pinia": "^4.0.3",
|
|
23
23
|
"pinia-plugin-persistedstate": "^4.7.1",
|
|
24
24
|
"radashi": "^12.9.1",
|
|
25
|
-
"vue": "^3.5.
|
|
26
|
-
"vue-router": "^5.
|
|
25
|
+
"vue": "^3.5.42",
|
|
26
|
+
"vue-router": "^5.3.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@antdv-next/auto-import-resolver": "^1.
|
|
30
|
-
"@antfu/eslint-config": "^9.
|
|
31
|
-
"@commitlint/cli": "^21.2.
|
|
32
|
-
"@commitlint/config-conventional": "^21.2.
|
|
33
|
-
"@types/node": "^26.
|
|
29
|
+
"@antdv-next/auto-import-resolver": "^1.2.0",
|
|
30
|
+
"@antfu/eslint-config": "^9.5.1",
|
|
31
|
+
"@commitlint/cli": "^21.2.2",
|
|
32
|
+
"@commitlint/config-conventional": "^21.2.2",
|
|
33
|
+
"@types/node": "^26.5.0",
|
|
34
34
|
"@types/nprogress": "^0.2.3",
|
|
35
|
-
"@unocss/eslint-plugin": "^66.
|
|
36
|
-
"@unocss/preset-attributify": "^66.
|
|
37
|
-
"@unocss/preset-wind4": "^66.
|
|
35
|
+
"@unocss/eslint-plugin": "^66.10.0",
|
|
36
|
+
"@unocss/preset-attributify": "^66.10.0",
|
|
37
|
+
"@unocss/preset-wind4": "^66.10.0",
|
|
38
38
|
"@vitejs/plugin-vue": "^6.0.8",
|
|
39
39
|
"@vue/tsconfig": "^0.9.1",
|
|
40
|
-
"eslint": "10.
|
|
40
|
+
"eslint": "10.10.0",
|
|
41
41
|
"eslint-plugin-format": "^2.0.1",
|
|
42
|
-
"eslint-plugin-oxlint": "^1.
|
|
43
|
-
"lefthook": "^2.1.
|
|
44
|
-
"oxlint": "^1.
|
|
45
|
-
"sass": "^1.
|
|
42
|
+
"eslint-plugin-oxlint": "^1.82.0",
|
|
43
|
+
"lefthook": "^2.1.12",
|
|
44
|
+
"oxlint": "^1.82.0",
|
|
45
|
+
"sass": "^1.104.0",
|
|
46
46
|
"typescript": "^6.0.3",
|
|
47
|
-
"unocss": "66.
|
|
48
|
-
"unplugin-auto-import": "^21.
|
|
47
|
+
"unocss": "66.10.0",
|
|
48
|
+
"unplugin-auto-import": "^21.1.0",
|
|
49
49
|
"unplugin-vue-components": "^32.1.0",
|
|
50
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@0.
|
|
50
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@0.3.0",
|
|
51
51
|
"vite-plugin-inspect": "^12.0.2",
|
|
52
52
|
"vite-plugin-svg-icons": "^2.0.1",
|
|
53
|
-
"vite-plus": "
|
|
54
|
-
"vue-tsc": "^3.3.
|
|
55
|
-
},
|
|
56
|
-
"devEngines": {
|
|
57
|
-
"packageManager": {
|
|
58
|
-
"name": "pnpm",
|
|
59
|
-
"version": "11.11.0",
|
|
60
|
-
"onFail": "download"
|
|
61
|
-
}
|
|
53
|
+
"vite-plus": "0.3.0",
|
|
54
|
+
"vue-tsc": "^3.3.11"
|
|
62
55
|
}
|
|
63
56
|
}
|
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
minimumReleaseAgeExcludePrune: true
|
|
2
|
+
trustPolicy: no-downgrade
|
|
3
|
+
|
|
4
|
+
peerDependencyRules:
|
|
5
|
+
allowedVersions:
|
|
6
|
+
# Vite+ core 使用自己的版本号,但提供兼容 Vite 的接口。
|
|
7
|
+
vite: 0.3.0
|
|
8
|
+
|
|
9
|
+
shellEmulator: true
|
|
10
|
+
|
|
11
|
+
overrides:
|
|
12
|
+
vite: npm:@voidzero-dev/vite-plus-core@0.3.0
|
|
13
|
+
vitest: 4.1.11
|
|
14
|
+
|
|
15
|
+
packageExtensions:
|
|
16
|
+
'@unocss/inspector@66.10.0':
|
|
17
|
+
dependencies:
|
|
18
|
+
# 与 inspector 使用的 @devframes/vite 对齐,避免解析到旧版 hub。
|
|
19
|
+
'@devframes/hub': 0.9.12
|
|
20
|
+
|
|
21
|
+
vite-plugin-svg-icons@2.0.1:
|
|
22
|
+
dependencies:
|
|
23
|
+
# 插件使用了 fast-glob,但发布包未声明此依赖。
|
|
24
|
+
fast-glob: ^3.3.3
|
|
25
|
+
|
|
1
26
|
allowBuilds:
|
|
2
|
-
'@parcel/watcher':
|
|
3
|
-
lefthook:
|
|
27
|
+
'@parcel/watcher': true
|
|
28
|
+
lefthook: true
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
+
import type { MenuItemType } from 'antdv-next'
|
|
2
3
|
import type { MenuRouteRecordRawType } from '@/router/interface'
|
|
3
4
|
|
|
4
5
|
import SvgIcon from '@/components/Icon/svg-icon.vue'
|
|
@@ -43,7 +44,7 @@ function renderIcon(icon?: string) {
|
|
|
43
44
|
return null
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
function getMenuItems(routes: MenuRouteRecordRawType[]) {
|
|
47
|
+
function getMenuItems(routes: MenuRouteRecordRawType[]): MenuItemType[] {
|
|
47
48
|
return routes
|
|
48
49
|
.filter(item => !item.meta?.hideInMenu)
|
|
49
50
|
.map((item) => {
|
|
@@ -51,14 +52,14 @@ function getMenuItems(routes: MenuRouteRecordRawType[]) {
|
|
|
51
52
|
if (hasChildren) {
|
|
52
53
|
return {
|
|
53
54
|
key: item.name as string,
|
|
54
|
-
label: item.meta?.title ?? item.name,
|
|
55
|
+
label: item.meta?.title ?? String(item.name ?? ''),
|
|
55
56
|
icon: renderIcon(item.meta?.icon),
|
|
56
57
|
children: getMenuItems(item.children as MenuRouteRecordRawType[]),
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
60
|
return {
|
|
60
61
|
key: item.name as string,
|
|
61
|
-
label: item.meta?.title ?? item.name,
|
|
62
|
+
label: item.meta?.title ?? String(item.name ?? ''),
|
|
62
63
|
icon: renderIcon(item.meta?.icon),
|
|
63
64
|
}
|
|
64
65
|
})
|