create-bubbles 0.0.23 → 0.1.1

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.
Files changed (38) hide show
  1. package/package.json +1 -1
  2. package/template-react-rsbuild-biome/.vscode/settings.json +6 -10
  3. package/template-react-rsbuild-biome/biome.json +3 -4
  4. package/template-react-rsbuild-biome/package.json +18 -17
  5. package/template-react-rsbuild-biome/src/pages/home/index.tsx +1 -1
  6. package/template-react-rsbuild-biome/src/styles/index.scss +2 -1
  7. package/template-react-rsbuild-biome/src/utils/request/core/index.ts +166 -0
  8. package/template-react-rsbuild-biome/src/utils/request/core/utils.ts +38 -0
  9. package/template-react-rsbuild-biome/src/utils/request/index.ts +34 -68
  10. package/template-vue-rolldown-oxc/.env +1 -3
  11. package/template-vue-rolldown-oxc/.env.development +1 -0
  12. package/template-vue-rolldown-oxc/.env.production +1 -0
  13. package/template-vue-rolldown-oxc/.prettierignore +34 -0
  14. package/template-vue-rolldown-oxc/package.json +17 -15
  15. package/template-vue-rolldown-oxc/src/main.ts +4 -6
  16. package/template-vue-rolldown-oxc/src/store/modules/user.ts +17 -0
  17. package/template-vue-rolldown-oxc/src/types/auto-import.d.ts +3 -1
  18. package/template-vue-rolldown-oxc/src/utils/env.ts +8 -3
  19. package/template-vue-rolldown-oxc/src/utils/request/core/index.ts +166 -0
  20. package/template-vue-rolldown-oxc/src/utils/request/core/utils.ts +38 -0
  21. package/template-vue-rolldown-oxc/src/utils/request/index.ts +41 -0
  22. package/template-vue-rolldown-oxc/vite.config.ts +2 -0
  23. package/template-vue-rsbuild-biome/.env +4 -2
  24. package/template-vue-rsbuild-biome/.env.development +1 -0
  25. package/template-vue-rsbuild-biome/.env.production +1 -0
  26. package/template-vue-rsbuild-biome/.vscode/settings.json +6 -0
  27. package/template-vue-rsbuild-biome/biome.json +3 -4
  28. package/template-vue-rsbuild-biome/package.json +14 -11
  29. package/template-vue-rsbuild-biome/rsbuild.config.ts +0 -1
  30. package/template-vue-rsbuild-biome/src/index.ts +0 -2
  31. package/template-vue-rsbuild-biome/src/utils/env.ts +10 -0
  32. package/template-vue-rsbuild-biome/src/utils/request/core/index.ts +166 -0
  33. package/template-vue-rsbuild-biome/src/utils/request/core/utils.ts +38 -0
  34. package/template-vue-rsbuild-biome/src/utils/request/index.ts +31 -69
  35. package/template-vue-rsbuild-biome/tsconfig.json +1 -1
  36. package/template-react-rsbuild-biome/src/utils/request/axios.ts +0 -83
  37. package/template-vue-rolldown-oxc/postcss.config.js +0 -5
  38. package/template-vue-rsbuild-biome/src/utils/request/axios.ts +0 -83
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-bubbles",
3
- "version": "0.0.23",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "author": "bubbles plant",
6
6
  "bin": {
@@ -1,14 +1,10 @@
1
1
  {
2
2
  "editor.formatOnSave": true,
3
- "editor.defaultFormatter": "biomejs.biome", // 控制相关文件嵌套展示
4
- "explorer.fileNesting.enabled": true,
5
- "explorer.fileNesting.expand": false,
6
- "explorer.fileNesting.patterns": {
7
- "*.ts": "$(capture).test.ts, $(capture).test.tsx",
8
- "*.tsx": "$(capture).test.ts, $(capture).test.tsx",
9
- "*.env": "$(capture).env.*",
10
- "package.json": "pnpm-lock.yaml",
11
- ".prettierrc": ".prettierignore"
3
+ "editor.defaultFormatter": "biomejs.biome",
4
+ "editor.codeActionsOnSave": {
5
+ "source.fixAll.biome": "explicit"
12
6
  },
13
- "cSpell.words": ["ahooks", "ianvs", "lefthook", "rsbuild", "rspack", "unocss", "unplugin"]
7
+ "[less]": {
8
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
9
+ }
14
10
  }
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
3
3
  "files": {
4
- "ignoreUnknown": true
4
+ "ignoreUnknown": true,
5
+ "includes": ["**", "!public/**/*", "!node_modules/**/*", "!dist/**/*"]
5
6
  },
6
7
  "formatter": {
7
8
  "enabled": true,
@@ -54,9 +55,7 @@
54
55
  "useAriaPropsForRole": "off",
55
56
  "useValidAnchor": "off"
56
57
  },
57
- "nursery": {
58
- "useUniqueElementIds": "off"
59
- }
58
+ "nursery": "off"
60
59
  }
61
60
  },
62
61
  "css": {
@@ -12,31 +12,32 @@
12
12
  "reinstall": "rimraf pnpm-lock.yaml && rimraf node_modules && pnpm install"
13
13
  },
14
14
  "dependencies": {
15
+ "@alova/adapter-axios": "^2.0.16",
15
16
  "@ant-design/icons-vue": "^7.0.1",
16
- "ahooks": "^3.9.0",
17
- "antd": "^5.26.7",
18
- "axios": "^1.11.0",
19
- "dayjs": "^1.11.13",
17
+ "ahooks": "^3.9.5",
18
+ "alova": "^3.3.4",
19
+ "antd": "^5.27.3",
20
+ "dayjs": "^1.11.18",
20
21
  "react": "^19.1.1",
21
22
  "react-dom": "^19.1.1",
22
- "react-router": "^7.8.0",
23
- "zustand": "^5.0.7"
23
+ "react-router": "^7.8.2",
24
+ "zustand": "^5.0.8"
24
25
  },
25
26
  "devDependencies": {
26
- "@biomejs/biome": "^2.1.4",
27
+ "@biomejs/biome": "^2.2.4",
27
28
  "@commitlint/config-conventional": "^19.8.1",
28
- "@ianvs/prettier-plugin-sort-imports": "^4.6.1",
29
- "@rsbuild/core": "^1.4.15",
30
- "@rsbuild/plugin-react": "^1.3.5",
31
- "@rsbuild/plugin-sass": "^1.3.5",
29
+ "@ianvs/prettier-plugin-sort-imports": "^4.7.0",
30
+ "@rsbuild/core": "^1.5.6",
31
+ "@rsbuild/plugin-react": "^1.4.0",
32
+ "@rsbuild/plugin-sass": "^1.4.0",
32
33
  "@rsbuild/plugin-svgr": "^1.2.2",
33
- "@types/react": "^19.1.9",
34
- "@types/react-dom": "^19.1.7",
35
- "@unocss/postcss": "66.4.2",
36
- "lefthook": "^1.12.2",
34
+ "@types/react": "^19.1.12",
35
+ "@types/react-dom": "^19.1.9",
36
+ "@unocss/postcss": "^66.5.1",
37
+ "lefthook": "^1.13.0",
37
38
  "prettier": "^3.6.2",
38
39
  "typescript": "^5.9.2",
39
- "unocss": "66.4.2",
40
- "unplugin-auto-import": "^20.0.0"
40
+ "unocss": "^66.5.1",
41
+ "unplugin-auto-import": "^20.1.0"
41
42
  }
42
43
  }
@@ -1,5 +1,5 @@
1
1
  const Home = () => {
2
- return <h1 className="flex-center w-full h-full text-green abc-var(--menu-bg)">111</h1>
2
+ return <h1 className="flex-center w-full h-full text-red abc-var(--menu-bg)">1112</h1>
3
3
  }
4
4
 
5
5
  export default Home
@@ -1,4 +1,5 @@
1
- @unocss;
1
+ @unocss preflights;
2
+ @unocss default;
2
3
  @import "./variables.scss";
3
4
  @import "./fonts.scss";
4
5
 
@@ -0,0 +1,166 @@
1
+ import { type AlovaGenerics, type AlovaOptions, createAlova } from 'alova'
2
+ import { deepMergeObject, isReadableStream } from './utils'
3
+ import adapterFetch from 'alova/fetch'
4
+
5
+ interface statusMap {
6
+ success?: number
7
+ unAuthorized?: number
8
+ }
9
+
10
+ interface codeMap {
11
+ success?: number[]
12
+ unAuthorized?: number[]
13
+ }
14
+
15
+ export interface baseRequestOption<AG extends AlovaGenerics> {
16
+ baseUrl?: string
17
+ timeout?: number
18
+ commonHeaders?: Record<string, string | (() => string)>
19
+ statusMap?: statusMap
20
+ codeMap?: codeMap
21
+ responseDataKey?: string
22
+ responseMessageKey?: string
23
+ isTransformResponse?: boolean
24
+ isShowSuccessMessage?: boolean
25
+ successDefaultMessage?: string
26
+ isShowErrorMessage?: boolean
27
+ errorDefaultMessage?: string
28
+ statesHook?: AlovaOptions<AG>['statesHook']
29
+ successMessageFunc?: (message: string) => void
30
+ errorMessageFunc?: (message: string) => void
31
+ unAuthorizedResponseFunc?: () => void
32
+ requestAdapter?: AlovaOptions<AG>['requestAdapter']
33
+ }
34
+
35
+ export interface CustomConfig {
36
+ isTransformResponse?: boolean
37
+ isShowSuccessMessage?: boolean
38
+ isShowErrorMessage?: boolean
39
+ }
40
+
41
+ type requestOption = baseRequestOption<AlovaGenerics> & CustomConfig
42
+
43
+ export const createInstance = (option: requestOption) => {
44
+ const defaultOption: requestOption = {
45
+ baseUrl: '/',
46
+ timeout: 0,
47
+ statusMap: {
48
+ success: 200,
49
+ unAuthorized: 401,
50
+ },
51
+ codeMap: {
52
+ success: [200],
53
+ unAuthorized: [401],
54
+ },
55
+ responseDataKey: 'data',
56
+ responseMessageKey: 'message',
57
+ isTransformResponse: true,
58
+ isShowSuccessMessage: false,
59
+ successDefaultMessage: '操作成功',
60
+ isShowErrorMessage: true,
61
+ errorDefaultMessage: '服务异常',
62
+ requestAdapter: adapterFetch(),
63
+ }
64
+
65
+ const mergeOption: baseRequestOption<AlovaGenerics> & CustomConfig = deepMergeObject(
66
+ defaultOption,
67
+ option,
68
+ )
69
+
70
+ const instance = createAlova({
71
+ baseURL: mergeOption.baseUrl,
72
+ timeout: mergeOption.timeout,
73
+ statesHook: mergeOption?.statesHook,
74
+ requestAdapter: mergeOption.requestAdapter as AlovaOptions<AlovaGenerics>['requestAdapter'],
75
+ beforeRequest: async (method) => {
76
+ for (const [key, value] of Object.entries(option?.commonHeaders ?? {})) {
77
+ method.config.headers[key] = typeof value === 'function' ? value() : value
78
+ }
79
+ },
80
+ responded: {
81
+ onSuccess: async (response) => {
82
+ if (!mergeOption?.isTransformResponse) return response
83
+ const { status } = response
84
+
85
+ // 判断响应类型:如果使用 adapterFetch,response.data 是可读流,则调用 json();否则直接使用 response.data
86
+ const data =
87
+ response?.body && isReadableStream(response.body)
88
+ ? await response.json() // adapterFetch 的响应,使用 json() 解析可读流
89
+ : response.data // 其他适配器的响应
90
+ // 不成功的情况
91
+ if (status !== mergeOption.statusMap?.success) {
92
+ // 如果后端使用status 字段来表示未授权,则返回401
93
+ if (mergeOption?.statusMap?.unAuthorized === status) {
94
+ mergeOption?.unAuthorizedResponseFunc?.()
95
+ }
96
+ return Promise.reject(response)
97
+ }
98
+
99
+ const {
100
+ responseDataKey,
101
+ codeMap,
102
+ isShowSuccessMessage,
103
+ responseMessageKey,
104
+ isShowErrorMessage,
105
+ } = mergeOption
106
+ const {
107
+ code,
108
+ [responseDataKey as string]: responseData,
109
+ [responseMessageKey as string]: responseMessage,
110
+ } = data
111
+ if (!codeMap?.success?.includes(+code)) {
112
+ // code unAuthorized 处理
113
+ if (codeMap?.unAuthorized?.includes(+code)) {
114
+ mergeOption?.unAuthorizedResponseFunc?.()
115
+ return Promise.reject(response)
116
+ }
117
+ // 其他错误直接打印msg
118
+
119
+ const errorMessage = data[responseMessageKey as string] ?? mergeOption.errorDefaultMessage
120
+ if (isShowErrorMessage) mergeOption?.errorMessageFunc?.(errorMessage)
121
+ return Promise.reject(response)
122
+ }
123
+ if (isShowSuccessMessage)
124
+ mergeOption?.successMessageFunc?.(responseMessage ?? mergeOption.successDefaultMessage)
125
+ return responseData
126
+ },
127
+ onError: (error) => {
128
+ if (mergeOption?.isShowErrorMessage)
129
+ mergeOption.errorMessageFunc?.(
130
+ error.response?.data?.message ?? mergeOption?.errorDefaultMessage,
131
+ )
132
+ },
133
+ // onComplete: (_method) => {},
134
+ },
135
+ })
136
+
137
+ return instance
138
+ }
139
+
140
+ // 🚀 创建双重调用实例的工厂函数
141
+ export const createDualCallInstance = (baseConfig: baseRequestOption<AlovaGenerics>) => {
142
+ // 创建默认实例
143
+ const defaultInstance = createInstance(baseConfig)
144
+
145
+ // 双重调用函数
146
+ const dualInstance = (option?: CustomConfig) => {
147
+ if (option) {
148
+ // 合并配置并创建新实例
149
+ const mergedConfig = { ...baseConfig, ...option }
150
+ return createInstance(mergedConfig)
151
+ }
152
+ return defaultInstance
153
+ }
154
+
155
+ // 🎯 直接绑定 HTTP 方法,无需复杂类型注释
156
+ dualInstance.Get = defaultInstance.Get.bind(defaultInstance)
157
+ dualInstance.Post = defaultInstance.Post.bind(defaultInstance)
158
+ dualInstance.Put = defaultInstance.Put.bind(defaultInstance)
159
+ dualInstance.Delete = defaultInstance.Delete.bind(defaultInstance)
160
+ dualInstance.Patch = defaultInstance.Patch.bind(defaultInstance)
161
+ dualInstance.Head = defaultInstance.Head.bind(defaultInstance)
162
+ dualInstance.Options = defaultInstance.Options.bind(defaultInstance)
163
+ dualInstance.Request = defaultInstance.Request.bind(defaultInstance)
164
+
165
+ return dualInstance
166
+ }
@@ -0,0 +1,38 @@
1
+ export const deepMergeObject = <T = any>(source: T, target: Partial<T>): T => {
2
+ const isObject = (obj: any): obj is Record<string, any> =>
3
+ obj && typeof obj === 'object' && !Array.isArray(obj)
4
+
5
+ const merge = (src: any, tgt: any): any => {
6
+ if (isObject(src) && isObject(tgt)) {
7
+ Object.keys(tgt).forEach((key) => {
8
+ if (isObject(tgt[key])) {
9
+ src[key] = merge(src[key] || {}, tgt[key])
10
+ } else {
11
+ src[key] = tgt[key]
12
+ }
13
+ })
14
+ }
15
+ return src
16
+ }
17
+
18
+ return merge({ ...source }, target)
19
+ }
20
+
21
+ /**
22
+ * 判断一个变量是不是可读流
23
+ * @param data
24
+ */
25
+ export const isReadableStream = (data: unknown): boolean => {
26
+ if (!(data instanceof ReadableStream)) {
27
+ return false
28
+ }
29
+ if (typeof data.locked !== 'boolean') return false
30
+
31
+ const instanceFunc = ['cancel', 'getReader', 'pipeThrough', 'pipeTo', 'tee'] as const
32
+
33
+ for (const func of instanceFunc) {
34
+ if (typeof data[func] !== 'function') return false
35
+ }
36
+
37
+ return true
38
+ }
@@ -1,77 +1,43 @@
1
- import type { AxiosRequestConfig } from 'axios'
1
+ import { envVariables } from '../env'
2
+ import { createDualCallInstance } from './core'
3
+ import { router } from '@/router'
4
+ import { message } from 'antd'
5
+ import 'element-plus/es/components/message/style/css'
6
+ import vueHook from 'alova/vue'
7
+ import { axiosRequestAdapter } from '@alova/adapter-axios'
2
8
 
3
- import request, { type CustomConfig } from './axios'
9
+ // 🎯 获取基础配置
10
+ const getBaseConfig = (): Parameters<typeof createDualCallInstance>[0] => {
4
11
 
5
- interface createAxiosType {
6
- get: <T = any>(
7
- config: {
8
- url: string
9
- params?: AxiosRequestConfig['params']
10
- config?: AxiosRequestConfig<any>
12
+ return {
13
+ baseUrl: `/${envVariables.PUBLIC_API_AFFIX}`,
14
+ statusMap: {
15
+ success: 200,
16
+ unAuthorized: 401,
11
17
  },
12
- option?: CustomConfig,
13
- ) => Promise<T>
14
- post: <T = any>(
15
- config: {
16
- url: string
17
- data?: AxiosRequestConfig['data']
18
- params?: AxiosRequestConfig['params']
19
- config?: AxiosRequestConfig<any>
18
+ codeMap: {
19
+ success: [200],
20
20
  },
21
- option?: CustomConfig,
22
- ) => Promise<T>
23
- put: <T = any>(
24
- config: {
25
- url: string
26
- data?: AxiosRequestConfig['data']
27
- config?: AxiosRequestConfig<any>
21
+ responseDataKey: 'data',
22
+ responseMessageKey: 'msg',
23
+ commonHeaders: {
28
24
  },
29
- option?: CustomConfig,
30
- ) => Promise<T>
31
- delete: <T = any>(
32
- config: {
33
- url: string
34
- data?: AxiosRequestConfig['data']
35
- config?: AxiosRequestConfig<any>
25
+ successMessageFunc: (msg: string) => {
26
+ message.success(msg)
36
27
  },
37
- option?: CustomConfig,
38
- ) => Promise<T>
39
- }
40
-
41
- const createAxios: createAxiosType = {
42
- get: (config, option) =>
43
- request(option).get(config.url, {
44
- params: config.params,
45
- ...config?.config,
46
- }),
47
- post: (
48
- config: {
49
- url: string
50
- params?: Record<string, string>
51
- data?: any
52
- config?: AxiosRequestConfig<any>
28
+ errorMessageFunc: (msg: string) => {
29
+ message.error(msg)
53
30
  },
54
- option?: CustomConfig,
55
- ) => {
56
- let url = config.url
57
- if (config.params instanceof Object) {
58
- url += '?'
59
- const entries = Object.entries(config.params)
60
- for (let i = 0; i < entries.length; i++) {
61
- const [key, value] = entries[i]
62
- url += `${key}=${value}${i < entries.length - 1 ? '&' : ''}`
63
- }
64
- }
65
- return request(option).post(url, config?.data, config?.config)
66
- },
67
- put: (
68
- config: { url: string; data?: any; config?: AxiosRequestConfig<any> },
69
- option?: CustomConfig,
70
- ) => request(option).put(config.url, config?.data, config?.config),
71
- delete: (
72
- config: { url: string; config?: AxiosRequestConfig<any> },
73
- customConfig?: CustomConfig,
74
- ) => request(customConfig).delete(config.url, config?.config),
31
+ unAuthorizedResponseFunc: () => {
32
+ router.navigate('/login')
33
+ message.error('登录过期或未登录')
34
+ },
35
+ statesHook: vueHook,
36
+ requestAdapter: axiosRequestAdapter(),
37
+ }
75
38
  }
76
39
 
77
- export default createAxios
40
+ // 🚀 使用 alova-core 的双重调用功能,超级简洁!
41
+ const alovaRequest = createDualCallInstance(getBaseConfig())
42
+
43
+ export default alovaRequest
@@ -1,6 +1,4 @@
1
1
  VITE_PORT = 9405
2
2
  VITE_PATH = '/'
3
3
  VITE_APP_NAME = "xxx"
4
-
5
-
6
- VITE_API_AFFIX = 'pipe-network-api'
4
+ VITE_API_AFFIX = 'api'
@@ -0,0 +1 @@
1
+ PUBLIC_API_URL = 'http://localhost:8080'
@@ -0,0 +1 @@
1
+ PUBLIC_API_URL = 'http://localhost:8080'
@@ -0,0 +1,34 @@
1
+ **/*.png
2
+ **/*.svg
3
+ CODEOWNERS
4
+ .dockerignore
5
+ Dockerfile.ui-test
6
+ .dumi/tmp
7
+ .dumi/tmp-production
8
+ !dumi
9
+ # AUTHORS.txt
10
+ lib/
11
+ es/
12
+ dist/
13
+ # _site/
14
+ # server
15
+ # coverage/
16
+ # CNAME
17
+ LICENSE
18
+ yarn.lock
19
+ # netlify.toml
20
+ yarn-error.log
21
+ *.sh
22
+ *.snap
23
+ components/*/*.js
24
+ components/*/*.jsx
25
+ .gitignore
26
+ .npmignore
27
+ .prettierignore
28
+ .DS_Store
29
+ .editorconfig
30
+ .eslintignore
31
+ .history
32
+ **/*.yml
33
+ *.html
34
+ CHANGELOG.*.md
@@ -15,37 +15,39 @@
15
15
  "**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx,vue,astro,svelte}": "oxlint"
16
16
  },
17
17
  "dependencies": {
18
+ "@alova/adapter-axios": "^2.0.16",
18
19
  "@element-plus/icons-vue": "^2.3.2",
19
- "@vueuse/core": "^13.6.0",
20
- "dayjs": "^1.11.13",
20
+ "@vueuse/core": "^13.9.0",
21
+ "alova": "^3.3.4",
22
+ "axios": "^1.12.1",
23
+ "dayjs": "^1.11.18",
21
24
  "echarts": "^6.0.0",
22
- "element-plus": "^2.10.6",
25
+ "element-plus": "^2.11.2",
23
26
  "pinia": "^3.0.3",
24
- "pinia-plugin-persistedstate": "^4.4.1",
27
+ "pinia-plugin-persistedstate": "^4.5.0",
25
28
  "radash": "^12.1.1",
26
- "vue": "^3.5.18",
29
+ "vue": "^3.5.21",
27
30
  "vue-router": "^4.5.1"
28
31
  },
29
32
  "devDependencies": {
30
33
  "@commitlint/cli": "^19.8.1",
31
34
  "@commitlint/config-conventional": "^19.8.1",
32
- "@ianvs/prettier-plugin-sort-imports": "^4.6.1",
35
+ "@ianvs/prettier-plugin-sort-imports": "^4.7.0",
33
36
  "@prettier/plugin-oxc": "^0.0.4",
34
- "@unocss/postcss": "^66.4.2",
35
37
  "@vitejs/plugin-vue": "^6.0.1",
36
- "@vue/tsconfig": "^0.7.0",
38
+ "@vue/tsconfig": "^0.8.1",
37
39
  "fast-glob": "^3.3.3",
38
- "lefthook": "^1.12.2",
39
- "oxlint": "^1.11.1",
40
+ "lefthook": "^1.13.0",
41
+ "oxlint": "^1.15.0",
40
42
  "prettier": "^3.6.2",
41
- "sass": "^1.90.0",
43
+ "sass": "^1.92.1",
42
44
  "typescript": "~5.9.2",
43
- "unocss": "^66.4.2",
44
- "unplugin-auto-import": "^20.0.0",
45
+ "unocss": "^66.5.1",
46
+ "unplugin-auto-import": "^20.1.0",
45
47
  "unplugin-vue-components": "^29.0.0",
46
48
  "vite": "npm:rolldown-vite@latest",
47
- "vite-plugin-inspect": "^11.3.2",
49
+ "vite-plugin-inspect": "^11.3.3",
48
50
  "vite-plugin-svg-icons": "^2.0.1",
49
- "vue-tsc": "^3.0.5"
51
+ "vue-tsc": "^3.0.7"
50
52
  }
51
53
  }
@@ -1,14 +1,12 @@
1
- import { createApp } from 'vue'
2
-
3
- import '@/styles/index.scss'
4
1
  import '@/styles/element-plus-variables.css'
5
-
2
+ import '@/styles/index.scss'
3
+ import 'virtual:svg-icons-register'
4
+ import 'virtual:uno.css'
5
+ import { createApp } from 'vue'
6
6
  import App from './App.vue'
7
7
  import { setupRouter } from './router'
8
8
  import { setupStore } from './store'
9
9
 
10
- import 'virtual:svg-icons-register'
11
-
12
10
  const app = createApp(App)
13
11
  setupRouter(app)
14
12
  setupStore(app)
@@ -0,0 +1,17 @@
1
+ import { defineStore } from "pinia";
2
+ import { store } from "..";
3
+
4
+ export const useUserStore = defineStore(
5
+ 'user',{
6
+ state: () => {
7
+ return {
8
+ name: 'admin',
9
+ token: 'admin',
10
+ avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif'
11
+ }
12
+ },
13
+ })
14
+
15
+ export function useUserStoreWithOut() {
16
+ return useUserStore(store);
17
+ }
@@ -15,12 +15,14 @@ declare global {
15
15
  const effectScope: typeof import('vue')['effectScope']
16
16
  const getCurrentInstance: typeof import('vue')['getCurrentInstance']
17
17
  const getCurrentScope: typeof import('vue')['getCurrentScope']
18
+ const getCurrentWatcher: typeof import('vue')['getCurrentWatcher']
18
19
  const h: typeof import('vue')['h']
19
20
  const inject: typeof import('vue')['inject']
20
21
  const isProxy: typeof import('vue')['isProxy']
21
22
  const isReactive: typeof import('vue')['isReactive']
22
23
  const isReadonly: typeof import('vue')['isReadonly']
23
24
  const isRef: typeof import('vue')['isRef']
25
+ const isShallow: typeof import('vue')['isShallow']
24
26
  const markRaw: typeof import('vue')['markRaw']
25
27
  const nextTick: typeof import('vue')['nextTick']
26
28
  const onActivated: typeof import('vue')['onActivated']
@@ -71,6 +73,6 @@ declare global {
71
73
  // for type re-export
72
74
  declare global {
73
75
  // @ts-ignore
74
- export type { Component, Slot, Slots, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
76
+ export type { Component, Slot, Slots, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, ShallowRef, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
75
77
  import('vue')
76
78
  }
@@ -1,5 +1,10 @@
1
+ /**
2
+ * 通过一个文件导出所有的环境变量这样方便统一修改
3
+ * @returns
4
+ */
1
5
  export const envVariables = {
2
- APP_NAME: import.meta.env.VITE_APP_NAME,
3
- /* 接口前缀 */
4
- API_AFFIX: import.meta.env.VITE_API_AFFIX,
6
+ PUBLIC_PORT: import.meta.env.PUBLIC_PORT,
7
+ PUBLIC_PATH: import.meta.env.PUBLIC_PATH,
8
+ PUBLIC_APP_NAME: import.meta.env.PUBLIC_APP_NAME,
9
+ PUBLIC_API_AFFIX: import.meta.env.PUBLIC_API_AFFIX,
5
10
  }