zhytech-ui-mobile 1.0.1 → 1.0.2

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 (81) hide show
  1. package/.eslintignore +11 -0
  2. package/.eslintrc.cjs +253 -0
  3. package/.prettierignore +0 -0
  4. package/.prettierrc.json +9 -0
  5. package/.vscode/settings.json +131 -0
  6. package/index.html +39 -0
  7. package/package.json +3 -7
  8. package/shims-uni.d.ts +7 -0
  9. package/src/App.vue +24 -0
  10. package/src/components/dynamicForm/componentRenderer.vue +207 -0
  11. package/src/components/dynamicForm/components/advanced/index.ts +13 -0
  12. package/src/components/dynamicForm/components/advanced/upload.vue +108 -0
  13. package/src/components/dynamicForm/components/advanced/uploadImage.vue +107 -0
  14. package/src/components/dynamicForm/components/answerSheetPopup/answerSheetItem.vue +58 -0
  15. package/src/components/dynamicForm/components/answerSheetPopup/index.vue +111 -0
  16. package/src/components/dynamicForm/components/application/employee.vue +140 -0
  17. package/src/components/dynamicForm/components/application/grade.vue +183 -0
  18. package/src/components/dynamicForm/components/application/index.ts +14 -0
  19. package/src/components/dynamicForm/components/application/post.vue +136 -0
  20. package/src/components/dynamicForm/components/base/checkbox.vue +143 -0
  21. package/src/components/dynamicForm/components/base/index.ts +15 -0
  22. package/src/components/dynamicForm/components/base/input.vue +99 -0
  23. package/src/components/dynamicForm/components/base/label.vue +29 -0
  24. package/src/components/dynamicForm/components/base/radio.vue +155 -0
  25. package/src/components/dynamicForm/components/componentType.ts +16 -0
  26. package/src/components/dynamicForm/components/layout/groupLayout.vue +103 -0
  27. package/src/components/dynamicForm/components/layout/index.ts +12 -0
  28. package/src/components/dynamicForm/formRenderer.vue +567 -0
  29. package/src/components/dynamicForm/index.ts +21 -0
  30. package/src/components/dynamicForm/types/componentAttribute/advanced/uploadAttribute.ts +35 -0
  31. package/src/components/dynamicForm/types/componentAttribute/application/employeeAttribute.ts +42 -0
  32. package/src/components/dynamicForm/types/componentAttribute/application/gradeAttribute.ts +54 -0
  33. package/src/components/dynamicForm/types/componentAttribute/application/postAttribute.ts +42 -0
  34. package/src/components/dynamicForm/types/componentAttribute/base/checkboxAttribute.ts +38 -0
  35. package/src/components/dynamicForm/types/componentAttribute/base/inputAttribute.ts +31 -0
  36. package/src/components/dynamicForm/types/componentAttribute/base/radioAttribute.ts +30 -0
  37. package/src/components/dynamicForm/types/componentAttribute/baseAttribute.ts +110 -0
  38. package/src/components/dynamicForm/types/componentAttribute/editAttribute.ts +70 -0
  39. package/src/components/dynamicForm/types/componentAttribute/index.ts +37 -0
  40. package/src/components/dynamicForm/types/componentAttribute/layout/groupLayoutAttribute.ts +39 -0
  41. package/src/components/dynamicForm/types/documentView.ts +110 -0
  42. package/src/components/dynamicForm/types/enum.ts +109 -0
  43. package/src/components/dynamicForm/types/formAttribute.ts +93 -0
  44. package/src/components/dynamicForm/types/uploadOption.ts +31 -0
  45. package/src/env.d.ts +8 -0
  46. package/src/hooks/useMessage.ts +44 -0
  47. package/src/hooks/useToast.ts +29 -0
  48. package/src/hooks/useUtils.ts +201 -0
  49. package/src/index.ts +59 -0
  50. package/src/main.ts +19 -0
  51. package/src/manifest.json +72 -0
  52. package/src/pages/dynamicFormDemo.vue +1260 -0
  53. package/src/pages/dynamicFormExaminationDemo.vue +567 -0
  54. package/src/pages.json +58 -0
  55. package/src/shime-uni.d.ts +6 -0
  56. package/src/uni.scss +76 -0
  57. package/src/unocss/index.ts +20 -0
  58. package/src/unocss/rules.ts +139 -0
  59. package/src/unocss/shortcuts.ts +53 -0
  60. package/src/unocss/theme/index.ts +13 -0
  61. package/src/unocss/theme/themeOption/dark.ts +35 -0
  62. package/src/unocss/theme/themeOption/primary.ts +33 -0
  63. package/src/unocss/variants.ts +110 -0
  64. package/tsconfig.json +19 -0
  65. package/uno.config.ts +63 -0
  66. package/vite.config.ts +83 -0
  67. package/dist/build/h5/style.css +0 -1
  68. package/dist/build/h5/zhytech-ui-mobile.es.js +0 -19690
  69. package/dist/build/h5/zhytech-ui-mobile.umd.js +0 -6
  70. /package/{dist/build/h5 → src}/static/iconfont/iconfont.css +0 -0
  71. /package/{dist/build/h5 → src}/static/iconfont/iconfont.ttf +0 -0
  72. /package/{dist/build/h5 → src}/static/iconfont/iconfont.woff +0 -0
  73. /package/{dist/build/h5 → src}/static/iconfont/iconfont.woff2 +0 -0
  74. /package/{dist/build/h5 → src}/static/scss/actionSheet.scss +0 -0
  75. /package/{dist/build/h5 → src}/static/scss/button.scss +0 -0
  76. /package/{dist/build/h5 → src}/static/scss/checkbox.scss +0 -0
  77. /package/{dist/build/h5 → src}/static/scss/form.scss +0 -0
  78. /package/{dist/build/h5 → src}/static/scss/index.scss +0 -0
  79. /package/{dist/build/h5 → src}/static/scss/input.scss +0 -0
  80. /package/{dist/build/h5 → src}/static/scss/picker.scss +0 -0
  81. /package/{dist/build/h5 → src}/static/scss/radio.scss +0 -0
@@ -0,0 +1,20 @@
1
+ /*
2
+ * relative : \src\unocss\index.ts
3
+ * Author : 郭鹏超
4
+ * Date : 2024-08-23 11:20
5
+ * LastEditors : 郭鹏超
6
+ * LastEditTime : 2024-08-25 16:34
7
+ * Description :
8
+ * CodeIterationRecord:
9
+ */
10
+ import themes from "./theme/index";
11
+ import rules from "./rules";
12
+ import shortcuts from "./shortcuts";
13
+ import variants from "./variants";
14
+ const unocssOption = {
15
+ themes,
16
+ rules,
17
+ shortcuts,
18
+ variants
19
+ } as Record<string, any>;
20
+ export default unocssOption;
@@ -0,0 +1,139 @@
1
+ /*
2
+ * relative : \src\unocss\rules.ts
3
+ * Author : 郭鹏超
4
+ * Date : 2024-08-24 15:02
5
+ * LastEditors : 苏军志
6
+ * LastEditTime : 2025-09-04 08:32
7
+ * Description :规则
8
+ * CodeIterationRecord:
9
+ */
10
+
11
+ const rules = [
12
+ // font-size
13
+ [/^fs-(\d+)$/, ([, d]: any) => ({ "font-size": `${d}px` })],
14
+ // font-weight
15
+ [/^fw-(\d+)$/, ([, d]: any) => ({ "font-weight": `${d}` })],
16
+ // height
17
+ [/^h-(\d+)$/, ([, d]: any) => ({ height: `${d}px` })],
18
+ [/^hl-(\d+)$/, ([, d]: any) => ({ height: `${d}px`, "line-height": `${d}px` })],
19
+ // 宽
20
+ [
21
+ /^w-(\d+|datetime|date|time)$/,
22
+ ([, value]: any) => {
23
+ let width: string;
24
+ switch (value) {
25
+ // 时间日期宽度
26
+ case "datetime":
27
+ width = "130px";
28
+ break;
29
+ // 日期宽度
30
+ case "date":
31
+ width = "100px";
32
+ break;
33
+ // 时间宽度
34
+ case "time":
35
+ width = "80px";
36
+ break;
37
+ default:
38
+ width = `${value}px`;
39
+ }
40
+ return { width };
41
+ }
42
+ ],
43
+ // 边框border
44
+ [/^b-(\d+)$/, (match: any) => ({ "border-width": `${match[1]}px` })],
45
+ [/^b-(\d+)-#([\w]+)$/, (match: any) => ({ border: `solid ${match[1]}px #${match[2]}` })],
46
+ [/^bt-(\d+)-#([\w]+)$/, (match: any) => ({ "border-top": `solid ${match[1]}px #${match[2]}` })],
47
+ [/^bb-(\d+)-#([\w]+)$/, (match: any) => ({ "border-bottom": `solid ${match[1]}px #${match[2]}` })],
48
+ [/^bl-(\d+)-#([\w]+)$/, (match: any) => ({ "border-left": `solid ${match[1]}px #${match[2]}` })],
49
+ [/^br-(\d+)-#([\w]+)$/, (match: any) => ({ "border-right": `solid ${match[1]}px #${match[2]}` })],
50
+ // padding
51
+ [/^p-(\d+)$/, (match: any) => ({ padding: `${match[1]}px` })],
52
+ [/^px-(\d+)$/, (match: any) => ({ "padding-left": `${match[1]}px`, "padding-right": `${match[1]}px` })],
53
+ [/^py-(\d+)$/, (match: any) => ({ "padding-top": `${match[1]}px`, "padding-bottom": `${match[1]}px` })],
54
+ [/^pt-(\d+)$/, (match: any) => ({ "padding-top": `${match[1]}px` })],
55
+ [/^pb-(\d+)$/, (match: any) => ({ "padding-bottom": `${match[1]}px` })],
56
+ [/^pl-(\d+)$/, (match: any) => ({ "padding-left": `${match[1]}px` })],
57
+ [/^pr-(\d+)$/, (match: any) => ({ "padding-right": `${match[1]}px` })],
58
+ // margin
59
+ [/^m-(\d+)$/, (match: any) => ({ margin: `${match[1]}px` })],
60
+ [/^mx-(\d+)$/, (match: any) => ({ "margin-left": `${match[1]}px`, "margin-right": `${match[1]}px` })],
61
+ [/^my-(\d+)$/, (match: any) => ({ "margin-top": `${match[1]}px`, "margin-bottom": `${match[1]}px` })],
62
+ [/^mt-(\d+)$/, (match: any) => ({ "margin-top": `${match[1]}px` })],
63
+ [/^mb-(\d+)$/, (match: any) => ({ "margin-bottom": `${match[1]}px` })],
64
+ [/^ml-(\d+)$/, (match: any) => ({ "margin-left": `${match[1]}px` })],
65
+ [/^mr-(\d+)$/, (match: any) => ({ "margin-right": `${match[1]}px` })],
66
+ ["flex-1", { flex: 1 }],
67
+ // 背景图片铺满父级元素
68
+ [/^bgi-full-(.*)$/, (match: any) => ({ background: `url(${match[1]})`, "background-size": "100% 100%" })],
69
+ [/^bgs-(.*)-(.*)$/, (match: any) => ({ "background-size": `${match[1]} ${match[2]}` })],
70
+ // px计算
71
+ [/^hc-(\d+)$/, ([, d]: any) => ({ height: `calc(100% - ${d}px) !important` })],
72
+ [/^hc-(\d+)$/, ([, d]: any) => ({ height: `calc(100% - ${d}px) !important` })],
73
+ ["text-align-last-justify", { "text-align-last": "justify" }],
74
+ /**
75
+ * @description: 设置背景颜色
76
+ */
77
+ [
78
+ /^bgc-(.*)$/,
79
+ (match: any) => {
80
+ const color = `${match[1]}`;
81
+ return { "background-color": `${color}` };
82
+ }
83
+ ],
84
+ /**
85
+ * @description: 设置主题 背景颜色 字体颜色 边框颜色
86
+ */
87
+ [
88
+ /^theme-(bgc|color|bc)-(\w+)$/,
89
+ (match: any, { theme }: any) => {
90
+ const mapping: any = {
91
+ bgc: "background-color",
92
+ color: "color",
93
+ bc: "border-color"
94
+ };
95
+ const property = mapping[match[1]];
96
+ const colorName = match[2];
97
+ const colorValue = theme[colorName];
98
+ if (colorValue) {
99
+ return { [property]: `${colorValue} !important` }; // 返回样式,添加 !important
100
+ }
101
+ return {};
102
+ }
103
+ ],
104
+ /**
105
+ * @description: 设置按钮颜色
106
+ */
107
+ [
108
+ /^button-(\w+)$/,
109
+ (match: any, { theme }: any) => {
110
+ const colorName = match[1];
111
+ const colorValue = theme[colorName];
112
+ if (colorValue) {
113
+ return { "background-color": `${colorValue} !important`, color: colorName === "default" ? `${theme["fontColor"]} !important` : "" }; // 返回样式,添加 !important
114
+ }
115
+ return {};
116
+ }
117
+ ],
118
+ // 阴影
119
+ [
120
+ /^system-shadow-(.*?)-(.*?)-(.*?)-(.*?)$/, // 修改正则表达式以匹配两个颜色参数
121
+ (match: any) => {
122
+ const css = `${match[1] ?? "2"}px ${match[2] ?? "2px"}px ${match[3] ?? "1"}px ${match[4] ?? "0"}px ${
123
+ match[5] ?? "rgba(0, 0, 0, 0.2)"
124
+ }`;
125
+ return {
126
+ "box-shadow": css
127
+ };
128
+ }
129
+ ],
130
+ [
131
+ "p-safe",
132
+ {
133
+ padding: "env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)"
134
+ }
135
+ ],
136
+ ["pt-safe", { "padding-top": "env(safe-area-inset-top)" }],
137
+ ["pb-safe", { "padding-bottom": "env(safe-area-inset-bottom)" }]
138
+ ];
139
+ export default rules;
@@ -0,0 +1,53 @@
1
+ /*
2
+ * relative : \src\unocss\shortcuts.ts
3
+ * Author : 郭鹏超
4
+ * Date : 2024-08-24 15:02
5
+ * LastEditors : 苏军志
6
+ * LastEditTime : 2025-09-05 20:36
7
+ * Description :快捷方式
8
+ * CodeIterationRecord:
9
+ */
10
+ const shortcuts: Record<string, any>[] = [
11
+ {
12
+ "wh-full": "w-full h-full"
13
+ },
14
+ // 子集DOM元素横向布局 左对齐:left 两端对齐between 右对齐:right
15
+ [
16
+ /^aline-(.*)$/,
17
+ ([, c]: any) => {
18
+ let direction = c;
19
+ // 解决部分浏览器不支持 left,right
20
+ if (c === "left") {
21
+ direction = "start";
22
+ }
23
+ if (c === "right") {
24
+ direction = "end";
25
+ }
26
+ return `flex-justify-${direction} flex items-center flex-wrap gap-3px`;
27
+ }
28
+ ],
29
+ // 子集DOM元素纵向布局 左对齐:顶部对齐:start 底部对齐:end
30
+ [
31
+ /^y-aline-(.*)$/,
32
+ ([, c]: any) => {
33
+ return `flex flex-col justify-${c}`;
34
+ }
35
+ ],
36
+ // zhy-form组件专用
37
+ [
38
+ /^zhy-form-component-(.*)$/,
39
+ () => {
40
+ return "h-full pl-15 box-border";
41
+ }
42
+ ],
43
+ {
44
+ "dynamic-form-item-description": "pos-relative w-full min-h-16px my-5 p-5 pl-30! box-border c-#000000 line-height-tight"
45
+ },
46
+ {
47
+ "show-description": "bgc-#ffffdd b-2 b-dashed b-#ff0000"
48
+ },
49
+ {
50
+ "description-tip": "pos-absolute left-7px top-3px"
51
+ }
52
+ ];
53
+ export default shortcuts;
@@ -0,0 +1,13 @@
1
+ /*
2
+ * relative : e:\Code\CaseManagement\case-management-web\src\unocss\theme\index.ts
3
+ * Author : 郭鹏超
4
+ * Date : 2024-08-22 17:09
5
+ * LastEditors : 郭鹏超
6
+ * LastEditTime : 2024-10-15 15:25
7
+ * Description :
8
+ * CodeIterationRecord:
9
+ */
10
+ import primary from "./themeOption/primary";
11
+ import dark from "./themeOption/dark";
12
+ const themes = { primary, dark } as Record<string, any>;
13
+ export default themes;
@@ -0,0 +1,35 @@
1
+ /*
2
+ * FilePath : \src\unocss\theme\themeOption\dark.ts
3
+ * Author : 苏军志
4
+ * Date : 2025-09-03 15:58
5
+ * LastEditors : 苏军志
6
+ * LastEditTime : 2025-09-04 08:32
7
+ * Description : 黑暗主题
8
+ * CodeIterationRecord:
9
+ */
10
+
11
+ const textColor = "#cdd6f4";
12
+ const bgcColor = "#181825";
13
+ const dark = {
14
+ fontColor: textColor,
15
+ primaryFontColor: textColor,
16
+ hasBgcfontColor: textColor,
17
+ contentBgcColor: bgcColor,
18
+ bodyBgcColor: bgcColor,
19
+ borderColor: "#cccccc",
20
+ systemPrimary: textColor,
21
+ primary: bgcColor,
22
+ info: "#909399",
23
+ success: "#67c23a",
24
+ warning: "#e6a23c",
25
+ danger: "#ff0000",
26
+ create: "#14d8d8",
27
+ staging: "#ff7400",
28
+ read: "#8cc63e",
29
+ update: "#108bf7",
30
+ delete: "#f56c6c",
31
+ disabled: "#c0c4cc",
32
+ default: "#000000",
33
+ hoverColor: "#ffffff"
34
+ };
35
+ export default dark;
@@ -0,0 +1,33 @@
1
+ /*
2
+ * FilePath : \src\unocss\theme\themeOption\primary.ts
3
+ * Author : 苏军志
4
+ * Date : 2025-09-03 15:59
5
+ * LastEditors : 苏军志
6
+ * LastEditTime : 2025-09-04 08:33
7
+ * Description : 浅色主题
8
+ * CodeIterationRecord:
9
+ */
10
+
11
+ const primary = {
12
+ fontColor: "#000000",
13
+ primaryFontColor: "#3F51B5",
14
+ hasBgcfontColor: "#ffffff",
15
+ contentBgcColor: "#ffffff",
16
+ bodyBgcColor: "#f3f3f3",
17
+ borderColor: "#cccccc",
18
+ systemPrimary: "#0470d3",
19
+ primary: "#3F51B5",
20
+ info: "#909399",
21
+ success: "#67c23a",
22
+ warning: "#e6a23c",
23
+ danger: "#ff0000",
24
+ create: "#14d8d8",
25
+ staging: "#ff7400",
26
+ read: "#8cc63e",
27
+ update: "#3F51B5",
28
+ delete: "#f56c6c",
29
+ disabled: "#c0c4cc",
30
+ default: "#fff",
31
+ hoverColor: "#3F51B5"
32
+ };
33
+ export default primary;
@@ -0,0 +1,110 @@
1
+ /*
2
+ * relative : \src\unocss\variants.ts
3
+ * Author : 郭鹏超
4
+ * Date : 2024-08-24 15:02
5
+ * LastEditors : 苏军志
6
+ * LastEditTime : 2025-09-04 08:28
7
+ * Description :变体
8
+ * CodeIterationRecord:
9
+ */
10
+ const variants: any[] = [
11
+ /**
12
+ * 选择子级为指定标签的元素
13
+ * 用法示例: sons-html-div:bg-red-500
14
+ * 这将选择所有 div 元素并应用 bg-red-500 样式
15
+ */
16
+ (matcher: any) => {
17
+ const parentPrefix = "sons-html-";
18
+ if (!matcher.startsWith(parentPrefix)) {
19
+ return matcher;
20
+ }
21
+ // 提取标签名和实际的样式匹配器
22
+ const [tag, ...rest] = matcher.slice(parentPrefix.length).split(":");
23
+ const newMatcher = rest.join(":");
24
+ return {
25
+ matcher: newMatcher, // 去掉 'sons-html-<tag>:' 前缀
26
+ selector: (s: any) => `${s} ${tag}` // 选择子级为指定标签的元素
27
+ };
28
+ },
29
+
30
+ /**
31
+ * 选择直接子级为指定标签的元素
32
+ * 用法示例: son-html-div:bg-blue-500
33
+ * 这将选择所有直接子级 div 元素并应用 bg-blue-500 样式
34
+ */
35
+ (matcher: any) => {
36
+ const parentPrefix = "son-html-";
37
+ if (!matcher.startsWith(parentPrefix)) {
38
+ return matcher;
39
+ }
40
+
41
+ // 提取标签名和实际的样式匹配器
42
+ const [tag, ...rest] = matcher.slice(parentPrefix.length).split(":");
43
+ const newMatcher = rest.join(":");
44
+
45
+ return {
46
+ matcher: newMatcher, // 去掉 'son-html-<tag>:' 前缀
47
+ selector: (s: any) => `${s} > ${tag}` // 选择直接子级为指定标签的元素
48
+ };
49
+ },
50
+
51
+ /**
52
+ * 选择子级为指定类名的元素
53
+ * 用法示例: sons-class-my-class:bg-green-500
54
+ * 这将选择所有子级具有 my-class 类的元素并应用 bg-green-500 样式
55
+ */
56
+ (matcher: any) => {
57
+ const parentPrefix = "sons-class-";
58
+ if (!matcher.startsWith(parentPrefix)) {
59
+ return matcher;
60
+ }
61
+ // 提取类名和实际的样式匹配器
62
+ const [className, ...rest] = matcher.slice(parentPrefix.length).split(":");
63
+ const newMatcher = rest.join(":");
64
+ return {
65
+ matcher: newMatcher, // 去掉 'sons-class-<class>:' 前缀
66
+ selector: (s: any) => `${s} .${className}` // 选择子级为指定类名的元素
67
+ };
68
+ },
69
+ /**
70
+ * 选择指定标签的第 index 个元素
71
+ * 用法示例: nth-son-html-div-2:bg-purple-500
72
+ * 这将选择所有 div 元素的第二个并应用 bg-purple-500 样式
73
+ *
74
+ * 同时支持带连字符的标签,如: nth-son-html-uni-view-2:overflow-y-auto
75
+ * 这将选择所有 uni-view 元素的第二个并应用 overflow-y-auto 样式
76
+ */
77
+ (matcher: any) => {
78
+ const parentPrefix = "nth-son-html-";
79
+ if (!matcher.startsWith(parentPrefix)) {
80
+ return matcher;
81
+ }
82
+
83
+ // 提取标签名、索引和实际的样式匹配器
84
+ const parts = matcher.slice(parentPrefix.length).split(":");
85
+ const tagAndIndex = parts[0];
86
+ const rest = parts.slice(1);
87
+
88
+ // 查找最后一个连字符位置,它分隔标签名和索引
89
+ const lastHyphenIndex = tagAndIndex.lastIndexOf("-");
90
+ if (lastHyphenIndex === -1) {
91
+ return matcher;
92
+ }
93
+
94
+ // 提取标签名和索引
95
+ const tag = tagAndIndex.substring(0, lastHyphenIndex);
96
+ const index = tagAndIndex.substring(lastHyphenIndex + 1);
97
+
98
+ // 确保索引是一个数字
99
+ if (!/^\d+$/.test(index)) {
100
+ return matcher;
101
+ }
102
+
103
+ const newMatcher = rest.join(":");
104
+ return {
105
+ matcher: newMatcher, // 去掉 'nth-son-html-<tag>-<index>:' 前缀
106
+ selector: (s: any) => `${s} > ${tag}:nth-of-type(${index})` // 选择子级为指定标签的第 index 个元素
107
+ };
108
+ }
109
+ ];
110
+ export default variants;
package/tsconfig.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "extends": "@vue/tsconfig/tsconfig.json",
3
+ "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue", "auto-imports.d.ts"],
4
+ "compilerOptions": {
5
+ "sourceMap": true,
6
+ "baseUrl": ".",
7
+ "isolatedModules": false,
8
+ "paths": {
9
+ "@/*": ["./src/*"]
10
+ },
11
+ "lib": ["esnext", "dom"],
12
+ "types": ["@dcloudio/types", "@types/wechat-miniprogram", "@uni-helper/uni-app-types"],
13
+ "verbatimModuleSyntax": true,
14
+ "ignoreDeprecations": "5.0"
15
+ },
16
+ "vueCompilerOptions": {
17
+ "nativeTags": ["block", "component", "template", "slot"]
18
+ }
19
+ }
package/uno.config.ts ADDED
@@ -0,0 +1,63 @@
1
+ /*
2
+ * FilePath : \uno.config.ts
3
+ * Author : 苏军志
4
+ * Date : 2025-03-24 15:43
5
+ * LastEditors : 苏军志
6
+ * LastEditTime : 2025-09-04 15:51
7
+ * Description : unocss配置文件
8
+ * CodeIterationRecord:
9
+ */
10
+ import { defineConfig, presetUno, presetAttributify, presetIcons, transformerDirectives, transformerVariantGroup } from "unocss";
11
+ import { presetApplet, presetRemRpx, transformerAttributify } from "unocss-applet";
12
+ import unoCssOption from "./src/unocss/index";
13
+ const { themes, rules, shortcuts, variants } = unoCssOption;
14
+ const isMp = process.env?.UNI_PLATFORM?.startsWith("mp") ?? false;
15
+ const presets: any = [];
16
+ if (isMp) {
17
+ // 使用小程序预设
18
+ presets.push(presetApplet(), presetRemRpx());
19
+ } else {
20
+ presets.push(
21
+ // 非小程序用官方预设
22
+ presetUno(),
23
+ // 支持css class属性化
24
+ presetAttributify({
25
+ prefix: "un-",
26
+ prefixedOnly: true
27
+ })
28
+ );
29
+ }
30
+ export default defineConfig({
31
+ presets: [
32
+ ...presets,
33
+ // 支持图标,需要搭配图标库,eg: @iconify-json/carbon, 使用 `<button class="i-carbon-sun dark:i-carbon-moon" />`
34
+ presetIcons({
35
+ scale: 1.2,
36
+ warn: true,
37
+ extraProperties: {
38
+ display: "inline-block",
39
+ "vertical-align": "middle"
40
+ }
41
+ }),
42
+ unoCssOption
43
+ ],
44
+ layers: {
45
+ components: -2,
46
+ default: 1,
47
+ user: 2
48
+ },
49
+ transformers: [
50
+ transformerVariantGroup(),
51
+ transformerDirectives(),
52
+ transformerAttributify({
53
+ // 解决与第三方框架样式冲突问题
54
+ prefixedOnly: true,
55
+ prefix: "zhy"
56
+ })
57
+ ],
58
+ variants: variants,
59
+ rules: rules,
60
+ shortcuts: shortcuts,
61
+ // 主题暂时使用primary
62
+ theme: themes.primary
63
+ });
package/vite.config.ts ADDED
@@ -0,0 +1,83 @@
1
+ /*
2
+ * FilePath : \vite.config.ts
3
+ * Author : 苏军志
4
+ * Date : 2024-04-19 14:12
5
+ * LastEditors : 苏军志
6
+ * LastEditTime : 2025-09-06 09:00
7
+ * Description :
8
+ * CodeIterationRecord:
9
+ */
10
+ import path from "path";
11
+ import uni from "@dcloudio/vite-plugin-uni";
12
+ import UnoCSS from "unocss/vite";
13
+ import AutoImport from "unplugin-auto-import/vite";
14
+ import { defineConfig } from "vite";
15
+
16
+ // https://vitejs.dev/config/
17
+ export default defineConfig(() => {
18
+ return {
19
+ server: {
20
+ port: 6790,
21
+ // 显示IP地址
22
+ host: true,
23
+ // 端口占用直接退出
24
+ strictPort: true,
25
+ // 启动后是否自动打开浏览器
26
+ open: false
27
+ },
28
+ plugins: [
29
+ uni(),
30
+ // UnoCSS({ mode: "vue-scoped" }),
31
+ UnoCSS(),
32
+ AutoImport({
33
+ dirs: ["src/hooks/", "src/types/"],
34
+ // 需要去解析的文件
35
+ include: [
36
+ /\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
37
+ /\.vue$/,
38
+ /\.vue\?vue/, // .vue
39
+ /\.md$/ // .md
40
+ ],
41
+ // imports 指定自动引入的包位置(名)
42
+ imports: ["vue", "uni-app", "@vueuse/core"],
43
+ // 生成相应的自动导入json文件。
44
+ eslintrc: {
45
+ // 启用
46
+ enabled: true,
47
+ // 生成自动导入json文件位置
48
+ filepath: "./.eslintrc-auto-import.json",
49
+ // 全局属性值
50
+ globalsPropValue: true
51
+ }
52
+ })
53
+ ],
54
+ css: {
55
+ preprocessorOptions: {
56
+ scss: {
57
+ // 加载全局样式,使用scss特性
58
+ additionalData: '@import "./src/static/scss/index.scss";'
59
+ }
60
+ }
61
+ },
62
+ build: {
63
+ outDir: "dist",
64
+ assetsDir: "static",
65
+ lib: {
66
+ entry: path.resolve(__dirname, "src/index.ts"),
67
+ name: "zhytech-ui-mobile",
68
+ fileName: (format) => `zhytech-ui-mobile.${format}.js`
69
+ },
70
+ rollupOptions: {
71
+ // 确保外部化处理那些你不想打包进库的依赖
72
+ external: ["vue"],
73
+ output: {
74
+ exports: "named",
75
+ // 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
76
+ globals: {
77
+ vue: "Vue"
78
+ }
79
+ }
80
+ }
81
+ }
82
+ };
83
+ });