@gx-design-vue/create-gx-cli 0.1.2 → 0.1.4
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/README.md +4 -11
- package/package.json +3 -2
- package/src/main.js +9 -3
- package/template-mobile-vant-cli/.env +0 -0
- package/template-mobile-vant-cli/.env.pro +1 -1
- package/template-mobile-vant-cli/.env.production +2 -2
- package/template-mobile-vant-cli/.eslintignore +0 -1
- package/template-mobile-vant-cli/build/plugin/autoImport.ts +8 -10
- package/template-mobile-vant-cli/build/plugin/index.ts +2 -10
- package/template-mobile-vant-cli/build/plugin/mock.ts +5 -11
- package/template-mobile-vant-cli/build/plugin/viteMock/client.ts +88 -0
- package/template-mobile-vant-cli/build/plugin/viteMock/createMockServer.ts +271 -0
- package/template-mobile-vant-cli/build/plugin/viteMock/index.ts +69 -0
- package/template-mobile-vant-cli/build/plugin/viteMock/types.ts +48 -0
- package/template-mobile-vant-cli/build/plugin/viteMock/utils.ts +48 -0
- package/template-mobile-vant-cli/eslint.config.js +49 -0
- package/template-mobile-vant-cli/mock/_createProductionServer.ts +4 -4
- package/template-mobile-vant-cli/mock/datasSource/api/index.ts +0 -0
- package/template-mobile-vant-cli/package.json +26 -33
- package/template-mobile-vant-cli/src/components/PageContainer/ProSkeleton.tsx +1 -2
- package/template-mobile-vant-cli/src/components/PageContainer/index.tsx +7 -6
- package/template-mobile-vant-cli/src/components/PageContainer/style.module.less +1 -1
- package/template-mobile-vant-cli/src/core/vant-design/index.ts +1 -1
- package/template-mobile-vant-cli/src/hooks/web/usePageLoading.ts +8 -5
- package/template-mobile-vant-cli/src/layout/BasicLayout.vue +3 -3
- package/template-mobile-vant-cli/src/pages/home.vue +27 -27
- package/template-mobile-vant-cli/src/router/index.ts +3 -2
- package/template-mobile-vant-cli/src/router/typings.ts +1 -1
- package/template-mobile-vant-cli/src/settings/index.ts +2 -2
- package/template-mobile-vant-cli/src/store/modules/global.ts +1 -1
- package/template-mobile-vant-cli/src/utils/crypto/base64.ts +101 -0
- package/template-mobile-vant-cli/src/utils/{cryptoJS.ts → crypto/index.ts} +23 -5
- package/template-mobile-vant-cli/src/utils/env.ts +15 -17
- package/template-mobile-vant-cli/src/utils/pageTitle.ts +5 -3
- package/template-mobile-vant-cli/src/utils/request/XHR.ts +38 -30
- package/template-mobile-vant-cli/src/utils/request/axiosCancel.ts +32 -23
- package/template-mobile-vant-cli/src/utils/request/checkStatus.ts +1 -3
- package/template-mobile-vant-cli/src/utils/request/index.ts +3 -4
- package/template-mobile-vant-cli/src/utils/request/typings.ts +74 -17
- package/template-mobile-vant-cli/src/utils/storage.ts +25 -18
- package/template-mobile-vant-cli/src/utils/util.ts +0 -5
- package/template-mobile-vant-cli/src/utils/validate.ts +191 -3
- package/template-mobile-vant-cli/tsconfig.json +8 -9
- package/template-mobile-vant-cli/types/{gx-components.d.ts → ant-design-import.d.ts} +3 -3
- package/template-mobile-vant-cli/types/auto-imports.d.ts +3 -0
- package/template-mobile-vant-cli/types/components.d.ts +2 -5
- package/template-mobile-vant-cli/types/global.d.ts +7 -4
- package/template-mobile-vant-cli/types/module.d.ts +15 -2
- package/template-mobile-vant-cli/types/plugins-auto-import.d.ts +14 -0
- package/template-mobile-vant-cli/types/response.d.ts +8 -5
- package/template-mobile-vant-cli/types/vant-import.d.ts +13 -0
- package/template-mobile-vant-cli/unocss.config.ts +101 -0
- package/template-mobile-vant-cli/vite.config.ts +43 -11
- package/template-mobile-vant-cli/.eslintrc.js +0 -64
- package/template-mobile-vant-cli/.stylelintignore +0 -3
- package/template-mobile-vant-cli/mock/api/index.ts +0 -66
- package/template-mobile-vant-cli/stylelint.config.js +0 -106
- /package/template-mobile-vant-cli/{postcss.config.js → postcss.config.cjs} +0 -0
- /package/template-mobile-vant-cli/{prettier.config.js → prettier.config.cjs} +0 -0
@@ -1,3 +1,191 @@
|
|
1
|
+
/**
|
2
|
+
* @author gx12358 2539306317@qq.com
|
3
|
+
* @description 判读是否为外链
|
4
|
+
* @param path
|
5
|
+
* @returns {boolean}
|
6
|
+
*/
|
7
|
+
export function isExternal(path) {
|
8
|
+
return /^(https?:|mailto:|tel:)/.test(path)
|
9
|
+
}
|
10
|
+
|
11
|
+
/**
|
12
|
+
* @author gx12358 2539306317@qq.com
|
13
|
+
* @description 判断是否是名称
|
14
|
+
* @param value
|
15
|
+
* @returns {boolean}
|
16
|
+
*/
|
17
|
+
export function isName(value) {
|
18
|
+
const reg = /^[\u4e00-\u9fa5a-zA-Z0-9]+$/
|
19
|
+
return reg.test(value)
|
20
|
+
}
|
21
|
+
|
22
|
+
/**
|
23
|
+
* @author gx12358 2539306317@qq.com
|
24
|
+
* @description 判断是否为IP
|
25
|
+
* @param ip
|
26
|
+
* @returns {boolean}
|
27
|
+
*/
|
28
|
+
export function isIP(ip) {
|
29
|
+
const reg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/
|
30
|
+
return reg.test(ip)
|
31
|
+
}
|
32
|
+
|
33
|
+
/**
|
34
|
+
* @author gx12358 2539306317@qq.com
|
35
|
+
* @description 判断是否是传统网站
|
36
|
+
* @param url
|
37
|
+
* @returns {boolean}
|
38
|
+
*/
|
39
|
+
export function isUrl(url) {
|
40
|
+
const reg = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/
|
41
|
+
return reg.test(url)
|
42
|
+
}
|
43
|
+
|
44
|
+
/**
|
45
|
+
* @author gx12358 2539306317@qq.com
|
46
|
+
* @description 判断是否是小写字母
|
47
|
+
* @param value
|
48
|
+
* @returns {boolean}
|
49
|
+
*/
|
50
|
+
export function isLowerCase(value) {
|
51
|
+
const reg = /^[a-z]+$/
|
52
|
+
return reg.test(value)
|
53
|
+
}
|
54
|
+
|
55
|
+
/**
|
56
|
+
* @author gx12358 2539306317@qq.com
|
57
|
+
* @description 判断是否是大写字母
|
58
|
+
* @param value
|
59
|
+
* @returns {boolean}
|
60
|
+
*/
|
61
|
+
export function isUpperCase(value) {
|
62
|
+
const reg = /^[A-Z]+$/
|
63
|
+
return reg.test(value)
|
64
|
+
}
|
65
|
+
|
66
|
+
/**
|
67
|
+
* @author gx12358 2539306317@qq.com
|
68
|
+
* @description 判断是否是大写字母开头
|
69
|
+
* @param value
|
70
|
+
* @returns {boolean}
|
71
|
+
*/
|
72
|
+
export function isAlphabets(value) {
|
73
|
+
const reg = /^[A-Za-z]+$/
|
74
|
+
return reg.test(value)
|
75
|
+
}
|
76
|
+
|
77
|
+
/**
|
78
|
+
* @author gx12358 2539306317@qq.com
|
79
|
+
* @description 判断是否是端口号
|
80
|
+
* @param value
|
81
|
+
* @returns {boolean}
|
82
|
+
*/
|
83
|
+
export function isPort(value) {
|
84
|
+
const reg = /^([0-9]|[1-9]\d|[1-9]\d{2}|[1-9]\d{3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5])$/
|
85
|
+
return reg.test(value)
|
86
|
+
}
|
87
|
+
|
88
|
+
/**
|
89
|
+
* @author gx12358 2539306317@qq.com
|
90
|
+
* @description 判断是否是手机号
|
91
|
+
* @param value
|
92
|
+
* @returns {boolean}
|
93
|
+
*/
|
94
|
+
export function isPhone(value = '', backReg?: boolean) {
|
95
|
+
const reg = /^1\d{10}$/
|
96
|
+
return backReg ? reg : reg.test(value)
|
97
|
+
}
|
98
|
+
|
99
|
+
/**
|
100
|
+
* @author gx12358 2539306317@qq.com
|
101
|
+
* @description 判断是否是身份证号(第二代)
|
102
|
+
* @param value
|
103
|
+
* @returns {boolean}
|
104
|
+
*/
|
105
|
+
export function isIdCard(value) {
|
106
|
+
const reg = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
|
107
|
+
return reg.test(value)
|
108
|
+
}
|
109
|
+
|
110
|
+
/**
|
111
|
+
* @author gx12358 2539306317@qq.com
|
112
|
+
* @description 判断是否是邮箱
|
113
|
+
* @param value
|
114
|
+
* @returns {boolean}
|
115
|
+
*/
|
116
|
+
export function isEmail(value = '', backReg?: boolean) {
|
117
|
+
const reg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/
|
118
|
+
return backReg ? reg : reg.test(value)
|
119
|
+
}
|
120
|
+
|
121
|
+
/**
|
122
|
+
* @author gx12358 2539306317@qq.com
|
123
|
+
* @description 判断是否中文
|
124
|
+
* @param value
|
125
|
+
* @returns {boolean}
|
126
|
+
*/
|
127
|
+
export function isChina(value) {
|
128
|
+
const reg = /^[\u4E00-\u9FA5]{2,4}$/
|
129
|
+
return reg.test(value)
|
130
|
+
}
|
131
|
+
|
132
|
+
/**
|
133
|
+
* @author gx12358 2539306317@qq.com
|
134
|
+
* @description 判断是否为空
|
135
|
+
* @param value
|
136
|
+
* @returns {boolean}
|
137
|
+
*/
|
138
|
+
export function isBlank(value) {
|
139
|
+
return (value == null || false || value === '' || value.trim() === '' || value.toLocaleLowerCase()
|
140
|
+
.trim() === 'null')
|
141
|
+
}
|
142
|
+
|
143
|
+
/**
|
144
|
+
* @author gx12358 2539306317@qq.com
|
145
|
+
* @description 判断是否为固话
|
146
|
+
* @param value
|
147
|
+
* @returns {boolean}
|
148
|
+
*/
|
149
|
+
export function isTel(value) {
|
150
|
+
const reg = /^(400|800)([0-9\\-]{7,10})|(([0-9]{4}|[0-9]{3})([- ])?)?([0-9]{7,8})(([- 转])*([0-9]{1,4}))?$/
|
151
|
+
return reg.test(value)
|
152
|
+
}
|
153
|
+
|
154
|
+
/**
|
155
|
+
* @author gx12358 2539306317@qq.com
|
156
|
+
* @description 判断经度 -180.0~+180.0(整数部分为0~180,必须输入1到5位小数)
|
157
|
+
* @param value
|
158
|
+
* @returns {boolean}
|
159
|
+
*/
|
160
|
+
export function isLongitude(value) {
|
161
|
+
const reg = /^[-|+]?(0?\d{1,2}\.\d{1,5}|1[0-7]?\d{1}\.\d{1,5}|180\.0{1,5})$/
|
162
|
+
return reg.test(value)
|
163
|
+
}
|
164
|
+
|
165
|
+
/**
|
166
|
+
* @author gx12358 2539306317@qq.com
|
167
|
+
* @description 判断纬度 -90.0~+90.0(整数部分为0~90,必须输入1到5位小数)
|
168
|
+
* @param value
|
169
|
+
* @returns {boolean}
|
170
|
+
*/
|
171
|
+
export function isLatitude(value) {
|
172
|
+
const reg = /^[-|+]?([0-8]?\d{1}\.\d{1,5}|90\.0{1,5})$/
|
173
|
+
return reg.test(value)
|
174
|
+
}
|
175
|
+
|
176
|
+
/**
|
177
|
+
* @author gx12358 2539306317@qq.com
|
178
|
+
* @description rtsp校验,只要有rtsp://
|
179
|
+
* @param value
|
180
|
+
* @returns {boolean}
|
181
|
+
*/
|
182
|
+
export function isRTSP(value) {
|
183
|
+
const reg = /^rtsp:\/\/([a-z]{0,10}:.{0,10}@)?(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/
|
184
|
+
const reg1 = /^rtsp:\/\/([a-z]{0,10}:.{0,10}@)?(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5]):[0-9]{1,5}/
|
185
|
+
const reg2 = /^rtsp:\/\/([a-z]{0,10}:.{0,10}@)?(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\//
|
186
|
+
return reg.test(value) || reg1.test(value) || reg2.test(value)
|
187
|
+
}
|
188
|
+
|
1
189
|
/**
|
2
190
|
* @Author gaoxiang
|
3
191
|
* @DateTime 2020/11/4
|
@@ -21,8 +209,8 @@ export function isJSONStr(str: any) {
|
|
21
209
|
}
|
22
210
|
|
23
211
|
export function checkURL(URL) {
|
24
|
-
const str = URL
|
25
|
-
|
26
|
-
|
212
|
+
const str = URL
|
213
|
+
const Expression = /http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/
|
214
|
+
const objExp = new RegExp(Expression)
|
27
215
|
return objExp.test(str)
|
28
216
|
}
|
@@ -1,23 +1,22 @@
|
|
1
1
|
{
|
2
2
|
"compilerOptions": {
|
3
|
-
"target": "
|
4
|
-
"module": "
|
5
|
-
"moduleResolution": "
|
3
|
+
"target": "ESNext",
|
4
|
+
"module": "ESNext",
|
5
|
+
"moduleResolution": "Node",
|
6
6
|
"forceConsistentCasingInFileNames": true,
|
7
7
|
"allowSyntheticDefaultImports": true,
|
8
8
|
"strictFunctionTypes": false,
|
9
9
|
"jsx": "preserve",
|
10
10
|
"baseUrl": "./",
|
11
|
-
"scripts": false,
|
12
|
-
"noEmit": true,
|
13
11
|
"allowJs": true,
|
14
12
|
"sourceMap": true,
|
15
13
|
"esModuleInterop": true,
|
16
14
|
"resolveJsonModule": true,
|
15
|
+
"noUnusedLocals": true,
|
16
|
+
"noUnusedParameters": true,
|
17
17
|
"experimentalDecorators": true,
|
18
|
-
"lib": ["
|
18
|
+
"lib": ["DOM", "ESNext"],
|
19
19
|
"types": ["vite/client"],
|
20
|
-
"typeRoots": ["./node_modules/@types/", "./types"],
|
21
20
|
"skipLibCheck": true,
|
22
21
|
"paths": {
|
23
22
|
"@/*": ["src/*"],
|
@@ -32,8 +31,8 @@
|
|
32
31
|
"src/**/*.d.ts",
|
33
32
|
"src/**/*.tsx",
|
34
33
|
"src/**/*.vue",
|
35
|
-
"types
|
36
|
-
"types
|
34
|
+
"types/*.d.ts",
|
35
|
+
"types/*.ts",
|
37
36
|
"build/**/*.ts",
|
38
37
|
"build/**/*.d.ts",
|
39
38
|
"mock/**/*.ts",
|
@@ -1,13 +1,13 @@
|
|
1
1
|
// generated by unplugin-vue-components
|
2
2
|
// We suggest you to commit this file into source control
|
3
|
-
// Read more: https://github.com/vuejs/
|
3
|
+
// Read more: https://github.com/vuejs/core/pull/3399
|
4
4
|
import '@vue/runtime-core'
|
5
5
|
|
6
6
|
export {}
|
7
7
|
|
8
8
|
declare module '@vue/runtime-core' {
|
9
9
|
export interface GlobalComponents {
|
10
|
-
|
10
|
+
RouterLink: typeof import('vue-router')['RouterLink']
|
11
|
+
RouterView: typeof import('vue-router')['RouterView']
|
11
12
|
}
|
12
13
|
}
|
13
|
-
|
@@ -39,6 +39,7 @@ declare global {
|
|
39
39
|
const ref: typeof import('vue')['ref']
|
40
40
|
const resolveComponent: typeof import('vue')['resolveComponent']
|
41
41
|
const resolveDirective: typeof import('vue')['resolveDirective']
|
42
|
+
const setupStore: typeof import('../src/store/index')['setupStore']
|
42
43
|
const shallowReactive: typeof import('vue')['shallowReactive']
|
43
44
|
const shallowReadonly: typeof import('vue')['shallowReadonly']
|
44
45
|
const shallowRef: typeof import('vue')['shallowRef']
|
@@ -54,6 +55,8 @@ declare global {
|
|
54
55
|
const useRoute: typeof import('vue-router')['useRoute']
|
55
56
|
const useRouter: typeof import('vue-router')['useRouter']
|
56
57
|
const useSlots: typeof import('vue')['useSlots']
|
58
|
+
const useStore: typeof import('../src/store/index')['useStore']
|
59
|
+
const useStoreGlobal: typeof import('../src/store/index')['useStoreGlobal']
|
57
60
|
const watch: typeof import('vue')['watch']
|
58
61
|
const watchEffect: typeof import('vue')['watchEffect']
|
59
62
|
const watchPostEffect: typeof import('vue')['watchPostEffect']
|
@@ -1,15 +1,12 @@
|
|
1
1
|
// generated by unplugin-vue-components
|
2
2
|
// We suggest you to commit this file into source control
|
3
|
-
// Read more: https://github.com/vuejs/
|
3
|
+
// Read more: https://github.com/vuejs/vue-next/pull/3399
|
4
4
|
import '@vue/runtime-core'
|
5
5
|
|
6
6
|
export {}
|
7
7
|
|
8
8
|
declare module '@vue/runtime-core' {
|
9
9
|
export interface GlobalComponents {
|
10
|
-
|
11
|
-
RouterView: typeof import('vue-router')['RouterView']
|
12
|
-
VanButton: typeof import('vant/es')['Button']
|
13
|
-
VanCell: typeof import('vant/es')['Cell']
|
10
|
+
GProPageContainer: typeof import('./../src/components/PageContainer')['default']
|
14
11
|
}
|
15
12
|
}
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import type { PropType as
|
1
|
+
import type { PropType, CSSProperties as VueCSSProperties } from 'vue'
|
2
|
+
import type { CSSObject as ProCssObject } from 'ant-design-vue'
|
2
3
|
|
3
4
|
declare global {
|
4
5
|
const __APP_INFO__: {
|
@@ -11,15 +12,17 @@ declare global {
|
|
11
12
|
lastBuildTime: string;
|
12
13
|
}
|
13
14
|
|
14
|
-
declare
|
15
|
+
declare interface LocalResult {
|
15
16
|
value: any;
|
16
17
|
time: string;
|
17
18
|
expired: number;
|
18
19
|
}
|
19
20
|
|
20
|
-
declare type
|
21
|
+
declare type VuePropType<T> = PropType<T>
|
22
|
+
declare type CSSObject = ProCssObject
|
23
|
+
declare type CSSProperties = VueCSSProperties
|
21
24
|
|
22
|
-
declare type RecordType<T = string, K = any> = Record<T, K
|
25
|
+
declare type RecordType<T = string, K = any> = Record<T, K>
|
23
26
|
|
24
27
|
declare interface ViteEnv {
|
25
28
|
VITE_USE_MODE: string;
|
@@ -1,7 +1,20 @@
|
|
1
|
-
|
1
|
+
declare module '*.svg'
|
2
|
+
declare module '*.png'
|
3
|
+
declare module '*.jpg'
|
4
|
+
declare module '*.jpeg'
|
5
|
+
declare module '*.gif'
|
6
|
+
declare module '*.bmp'
|
7
|
+
declare module '*.tiff'
|
2
8
|
|
9
|
+
/// <reference types="vite/client" />
|
3
10
|
declare module '*.vue' {
|
4
11
|
import type { DefineComponent } from 'vue'
|
5
|
-
|
12
|
+
|
13
|
+
const Component: DefineComponent<Record<any, any>, Record<any, any>, any>
|
6
14
|
export default component
|
7
15
|
}
|
16
|
+
|
17
|
+
declare module 'virtual:*' {
|
18
|
+
const result: any
|
19
|
+
export default result
|
20
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
// generated by unplugin-vue-components
|
2
|
+
// We suggest you to commit this file into source control
|
3
|
+
// Read more: https://github.com/vuejs/core/pull/3399
|
4
|
+
import '@vue/runtime-core'
|
5
|
+
|
6
|
+
export {}
|
7
|
+
|
8
|
+
declare module '@vue/runtime-core' {
|
9
|
+
export interface GlobalComponents {
|
10
|
+
RouterLink: typeof import('vue-router')['RouterLink']
|
11
|
+
RouterView: typeof import('vue-router')['RouterView']
|
12
|
+
VanButton: typeof import('vant/es')['Button']
|
13
|
+
}
|
14
|
+
}
|
@@ -1,12 +1,15 @@
|
|
1
|
-
declare interface
|
1
|
+
declare interface DefaultResult<T> {
|
2
2
|
code: number;
|
3
3
|
msg?: string;
|
4
4
|
message?: string;
|
5
5
|
data?: T;
|
6
6
|
}
|
7
7
|
|
8
|
-
declare
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
declare type ResponseResult<T = any, R = undefined> = R extends undefined
|
9
|
+
? DefaultResult<T>
|
10
|
+
: DefaultResult<T> & R
|
11
|
+
|
12
|
+
declare interface PageResult<T> {
|
13
|
+
list: T[];
|
14
|
+
totalCount: number;
|
12
15
|
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// generated by unplugin-vue-components
|
2
|
+
// We suggest you to commit this file into source control
|
3
|
+
// Read more: https://github.com/vuejs/core/pull/3399
|
4
|
+
import '@vue/runtime-core'
|
5
|
+
|
6
|
+
export {}
|
7
|
+
|
8
|
+
declare module '@vue/runtime-core' {
|
9
|
+
export interface GlobalComponents {
|
10
|
+
RouterLink: typeof import('vue-router')['RouterLink']
|
11
|
+
RouterView: typeof import('vue-router')['RouterView']
|
12
|
+
}
|
13
|
+
}
|
@@ -0,0 +1,101 @@
|
|
1
|
+
import {
|
2
|
+
defineConfig,
|
3
|
+
presetAttributify,
|
4
|
+
presetUno,
|
5
|
+
transformerDirectives,
|
6
|
+
transformerVariantGroup
|
7
|
+
} from 'unocss'
|
8
|
+
|
9
|
+
export default defineConfig({
|
10
|
+
presets: [
|
11
|
+
presetUno(),
|
12
|
+
presetAttributify()
|
13
|
+
],
|
14
|
+
theme: {
|
15
|
+
breakpoints: {
|
16
|
+
sm: '576px',
|
17
|
+
md: '768px',
|
18
|
+
lg: '992px',
|
19
|
+
xl: '1200px',
|
20
|
+
xxl: '1600px'
|
21
|
+
}
|
22
|
+
},
|
23
|
+
transformers: [ transformerDirectives({
|
24
|
+
applyVariable: [ '--at-apply' ]
|
25
|
+
}), transformerVariantGroup() ],
|
26
|
+
shortcuts: [
|
27
|
+
{
|
28
|
+
'flex-center': 'flex items-center justify-center'
|
29
|
+
},
|
30
|
+
],
|
31
|
+
rules: [
|
32
|
+
[ /^text-rgba-(.*)$/, ([ , str ]) => {
|
33
|
+
const regex = /\[([^[\]]*)\]/
|
34
|
+
const match = str.match(regex)
|
35
|
+
|
36
|
+
if (match && match.length > 1) {
|
37
|
+
const contentInsideBrackets = match[1]
|
38
|
+
return {
|
39
|
+
color: `rgba(${contentInsideBrackets.split('-').join(',')})`
|
40
|
+
}
|
41
|
+
} else {
|
42
|
+
return {}
|
43
|
+
}
|
44
|
+
} ],
|
45
|
+
[ /^bg-rgba-(.*)$/, ([ , str ]) => {
|
46
|
+
const regex = /\[([^[\]]*)\]/
|
47
|
+
const match = str.match(regex)
|
48
|
+
|
49
|
+
if (match && match.length > 1) {
|
50
|
+
const contentInsideBrackets = match[1]
|
51
|
+
return {
|
52
|
+
'background-color': `rgba(${contentInsideBrackets.split('-').join(',')})`
|
53
|
+
}
|
54
|
+
} else {
|
55
|
+
return {}
|
56
|
+
}
|
57
|
+
} ],
|
58
|
+
[ /^text-hidden-(\d+)$/, ([ , d ]) => ({
|
59
|
+
'overflow': 'hidden',
|
60
|
+
'text-overflow': 'ellipsis',
|
61
|
+
'display': '-webkit-box',
|
62
|
+
'-webkit-line-clamp': d,
|
63
|
+
'line-clamp': d,
|
64
|
+
'-webkit-box-orient': 'vertical',
|
65
|
+
'word-break': 'break-word'
|
66
|
+
}) ],
|
67
|
+
[ 'hidden-none', { 'opacity': '0', 'visibility': 'hidden' } ],
|
68
|
+
[ /^flex-main-(\d+)$/, ([ , d ]) => ({
|
69
|
+
'flex': `0 0 ${d}px`
|
70
|
+
}) ],
|
71
|
+
[ /^shrink-(\d+)$/, ([ , d ]) => ({
|
72
|
+
'flex-shrink': d
|
73
|
+
}) ],
|
74
|
+
[ 'text-hex-main', { 'color': 'var(--gx-primary-color)' } ],
|
75
|
+
[ 'bg-hex-main', { 'background': 'var(--gx-primary-color)' } ],
|
76
|
+
[ 'word-break-all', { 'word-break': 'break-all' } ],
|
77
|
+
[ 'word-break-word', { 'word-break': 'break-word' } ],
|
78
|
+
[ 'flex-main', { 'flex': '1' } ],
|
79
|
+
[ 'position-all', { 'position': 'absolute', 'top': '0', 'bottom': '0', 'left': '0', 'right': '0' } ],
|
80
|
+
[ 'image-event-none', { 'user-select': 'none', 'pointer-events': 'none' } ],
|
81
|
+
[
|
82
|
+
'position-center', {
|
83
|
+
'left': '50%',
|
84
|
+
'top': '50%',
|
85
|
+
'transform': 'translate(-50%, -50%)'
|
86
|
+
}
|
87
|
+
],
|
88
|
+
[
|
89
|
+
'position-center-x', {
|
90
|
+
'left': '50%',
|
91
|
+
'transform': 'translateX(-50%)'
|
92
|
+
}
|
93
|
+
],
|
94
|
+
[
|
95
|
+
'position-center-y', {
|
96
|
+
'top': '50%',
|
97
|
+
'transform': 'translateY(-50%)'
|
98
|
+
}
|
99
|
+
]
|
100
|
+
]
|
101
|
+
})
|
@@ -1,7 +1,8 @@
|
|
1
|
-
import type {
|
1
|
+
import type { ConfigEnv, ProxyOptions, UserConfig } from 'vite'
|
2
2
|
import { loadEnv } from 'vite'
|
3
|
-
import { resolve } from 'path'
|
3
|
+
import { resolve } from 'node:path'
|
4
4
|
import dayjs from 'dayjs'
|
5
|
+
import { isObject, isString } from '@gx-design-vue/pro-utils'
|
5
6
|
|
6
7
|
import { configManualChunk } from './build/optimizer'
|
7
8
|
import { createVitePlugins } from './build/plugin'
|
@@ -9,6 +10,10 @@ import { generateModifyVars } from './build/generateModifyVars'
|
|
9
10
|
|
10
11
|
import pkg from './package.json'
|
11
12
|
|
13
|
+
type ProxyTargetList = ProxyOptions & { rewrite: (path: string) => string }
|
14
|
+
|
15
|
+
const proxyTarget: string | Record<string, any> = 'http://127.0.0.1:3000'
|
16
|
+
|
12
17
|
const { dependencies, devDependencies, name, version } = pkg
|
13
18
|
|
14
19
|
const __APP_INFO__ = {
|
@@ -21,14 +26,37 @@ function pathResolve(dir: string) {
|
|
21
26
|
}
|
22
27
|
|
23
28
|
function createProxy(prefix) {
|
24
|
-
const ret
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
ws: true,
|
29
|
-
rewrite: (path) => path.replace(new RegExp(`^${prefix}`), `${prefix}`)
|
29
|
+
const ret = {
|
30
|
+
dev: {},
|
31
|
+
test: {},
|
32
|
+
pre: {}
|
30
33
|
}
|
31
|
-
|
34
|
+
|
35
|
+
if (isObject(proxyTarget)) {
|
36
|
+
Object.keys(proxyTarget).forEach((prefix) => {
|
37
|
+
const proxy = {
|
38
|
+
target: `${proxyTarget[prefix]}`,
|
39
|
+
changeOrigin: true,
|
40
|
+
ws: true,
|
41
|
+
rewrite: path => path.replace(new RegExp(`^${prefix}`), '')
|
42
|
+
} as ProxyTargetList
|
43
|
+
|
44
|
+
ret.dev[prefix] = proxy
|
45
|
+
ret.test[prefix] = proxy
|
46
|
+
ret.pre[prefix] = proxy
|
47
|
+
})
|
48
|
+
} else if (isString(proxyTarget)) {
|
49
|
+
const proxy = {
|
50
|
+
target: `${proxyTarget}`,
|
51
|
+
changeOrigin: true,
|
52
|
+
ws: true,
|
53
|
+
rewrite: path => path.replace(new RegExp(`^${prefix}`), '')
|
54
|
+
}
|
55
|
+
ret.dev[prefix] = proxy
|
56
|
+
ret.test[prefix] = proxy
|
57
|
+
ret.pre[prefix] = proxy
|
58
|
+
}
|
59
|
+
|
32
60
|
return ret
|
33
61
|
}
|
34
62
|
|
@@ -65,6 +93,10 @@ export default ({ mode, command }: ConfigEnv): UserConfig => {
|
|
65
93
|
find: '@',
|
66
94
|
replacement: pathResolve('src') + '/'
|
67
95
|
},
|
96
|
+
{
|
97
|
+
find: '@gx-mock',
|
98
|
+
replacement: pathResolve('mock') + '/'
|
99
|
+
},
|
68
100
|
{
|
69
101
|
find: '@gx-vuex',
|
70
102
|
replacement: pathResolve('src/store') + '/index.ts'
|
@@ -78,7 +110,7 @@ export default ({ mode, command }: ConfigEnv): UserConfig => {
|
|
78
110
|
},
|
79
111
|
server: {
|
80
112
|
host: true,
|
81
|
-
port:
|
113
|
+
port: 3000,
|
82
114
|
proxy: createProxy(VITE_BASE_URL)
|
83
115
|
},
|
84
116
|
plugins: createVitePlugins(viteEnv, isBuild),
|
@@ -94,7 +126,7 @@ export default ({ mode, command }: ConfigEnv): UserConfig => {
|
|
94
126
|
chunkSizeWarningLimit: 2500,
|
95
127
|
rollupOptions: {
|
96
128
|
output: {
|
97
|
-
manualChunks: configManualChunk
|
129
|
+
manualChunks: configManualChunk as any
|
98
130
|
}
|
99
131
|
}
|
100
132
|
},
|
@@ -1,64 +0,0 @@
|
|
1
|
-
module.exports = {
|
2
|
-
root: true,
|
3
|
-
env: {
|
4
|
-
browser: true,
|
5
|
-
node: true,
|
6
|
-
es6: true,
|
7
|
-
},
|
8
|
-
parser: 'vue-eslint-parser',
|
9
|
-
parserOptions: {
|
10
|
-
parser: '@typescript-eslint/parser',
|
11
|
-
ecmaVersion: 2020,
|
12
|
-
sourceType: 'module',
|
13
|
-
jsxPragma: 'React',
|
14
|
-
ecmaFeatures: {
|
15
|
-
jsx: true,
|
16
|
-
},
|
17
|
-
},
|
18
|
-
extends: [
|
19
|
-
'plugin:vue/vue3-recommended',
|
20
|
-
'plugin:@typescript-eslint/recommended'
|
21
|
-
],
|
22
|
-
rules: {
|
23
|
-
'vue/script-setup-uses-vars': 'error',
|
24
|
-
'@typescript-eslint/ban-ts-ignore': 'off',
|
25
|
-
'@typescript-eslint/explicit-function-return-type': 'off',
|
26
|
-
'@typescript-eslint/no-explicit-any': 'off',
|
27
|
-
'@typescript-eslint/no-var-requires': 'off',
|
28
|
-
'@typescript-eslint/no-empty-function': 'off',
|
29
|
-
'vue/custom-event-name-casing': 'off',
|
30
|
-
'no-use-before-define': 'off',
|
31
|
-
'@typescript-eslint/no-use-before-define': 'off',
|
32
|
-
'@typescript-eslint/ban-ts-comment': 'off',
|
33
|
-
'@typescript-eslint/ban-types': 'off',
|
34
|
-
'@typescript-eslint/no-non-null-assertion': 'off',
|
35
|
-
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
36
|
-
'@typescript-eslint/no-unused-vars': [
|
37
|
-
'error',
|
38
|
-
{
|
39
|
-
argsIgnorePattern: '^_',
|
40
|
-
varsIgnorePattern: '^_',
|
41
|
-
},
|
42
|
-
],
|
43
|
-
'no-unused-vars': [
|
44
|
-
'error',
|
45
|
-
{
|
46
|
-
argsIgnorePattern: '^_',
|
47
|
-
varsIgnorePattern: '^_',
|
48
|
-
},
|
49
|
-
],
|
50
|
-
'space-before-function-paren': 'off',
|
51
|
-
|
52
|
-
'vue/attributes-order': 'off',
|
53
|
-
'vue/one-component-per-file': 'off',
|
54
|
-
'vue/html-closing-bracket-newline': 'off',
|
55
|
-
'vue/max-attributes-per-line': 'off',
|
56
|
-
'vue/multiline-html-element-content-newline': 'off',
|
57
|
-
'vue/singleline-html-element-content-newline': 'off',
|
58
|
-
'vue/attribute-hyphenation': 'off',
|
59
|
-
'vue/require-default-prop': 'off',
|
60
|
-
'vue/require-explicit-emits': 'off',
|
61
|
-
'vue/html-self-closing': 0,
|
62
|
-
'vue/multi-word-component-names': 'off',
|
63
|
-
},
|
64
|
-
};
|