@agile-team/wl-skills-kit 2.3.0 → 2.3.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 (93) hide show
  1. package/CHANGELOG.md +42 -57
  2. package/README.md +23 -148
  3. package/bin/wl-skills.js +2 -100
  4. package/files/.github/guides/README.md +13 -13
  5. package/files/.github/guides/architecture.md +555 -576
  6. package/files/.github/guides/usage.md +176 -176
  7. package/files/.github/reports/README.md +65 -65
  8. package/files/.github/reports/SYS_DICT_INFO.md +50 -50
  9. package/files/.github/reports/SYS_MENU_INFO.md +247 -247
  10. package/files/.github/reports/SYS_PERMISSION_INFO.md +20 -20
  11. package/files/.github/reports//347/273/204/344/273/266/346/217/220/345/217/226/345/273/272/350/256/256.md +33 -33
  12. package/files/.github/reports//350/247/204/350/214/203/345/256/241/346/237/245/346/212/245/345/221/212.md +44 -44
  13. package/files/.github/skills/_compat/README.md +108 -108
  14. package/files/.github/skills/_compat/headers/agents.txt +8 -8
  15. package/files/.github/skills/_compat/headers/claude-code.txt +7 -7
  16. package/files/.github/skills/_compat/headers/cline.txt +7 -7
  17. package/files/.github/skills/_compat/headers/cursor-mdc.txt +16 -16
  18. package/files/.github/skills/_compat/headers/cursor-rules.txt +7 -7
  19. package/files/.github/skills/_compat/headers/github-copilot.txt +1 -1
  20. package/files/.github/skills/_compat/headers/kiro.txt +10 -10
  21. package/files/.github/skills/_compat/headers/trae.txt +11 -11
  22. package/files/.github/skills/_compat/headers/windsurf.txt +7 -7
  23. package/files/.github/skills/_registry.md +81 -81
  24. package/files/.github/skills/core/api-contract/SKILL.md +344 -344
  25. package/files/.github/skills/core/api-contract/USAGE.md +110 -110
  26. package/files/.github/skills/core/convention-audit/SKILL.md +189 -189
  27. package/files/.github/skills/core/convention-audit/USAGE.md +99 -99
  28. package/files/.github/skills/core/page-codegen/SKILL.md +973 -973
  29. package/files/.github/skills/core/page-codegen/USAGE.md +102 -102
  30. package/files/.github/skills/core/page-codegen/templates/_index.md +46 -46
  31. package/files/.github/skills/core/page-codegen/templates/domains/_CONTRIBUTING.md +107 -107
  32. package/files/.github/skills/core/page-codegen/templates/domains/produce/TPL-OPERATION-STATION.md +442 -442
  33. package/files/.github/skills/core/page-codegen/templates/domains/sale/README.md +26 -26
  34. package/files/.github/skills/core/page-codegen/templates/universal/TPL-CHANGE-HISTORY.md +276 -276
  35. package/files/.github/skills/core/page-codegen/templates/universal/TPL-DETAIL-TABS.md +1145 -1145
  36. package/files/.github/skills/core/page-codegen/templates/universal/TPL-DRIVEN.md +309 -124
  37. package/files/.github/skills/core/page-codegen/templates/universal/TPL-FORM-ROUTE.md +436 -436
  38. package/files/.github/skills/core/page-codegen/templates/universal/TPL-LIST.md +191 -191
  39. package/files/.github/skills/core/page-codegen/templates/universal/TPL-MASTER-DETAIL.md +148 -148
  40. package/files/.github/skills/core/page-codegen/templates/universal/TPL-RECORD-FORM.md +376 -376
  41. package/files/.github/skills/core/page-codegen/templates/universal/TPL-TREE-LIST.md +186 -186
  42. package/files/.github/skills/core/prototype-scan/SKILL.md +498 -498
  43. package/files/.github/skills/core/prototype-scan/USAGE.md +95 -95
  44. package/files/.github/skills/core/template-extract/SKILL.md +139 -139
  45. package/files/.github/skills/core/template-extract/USAGE.md +93 -93
  46. package/files/.github/skills/domain/README.md +51 -51
  47. package/files/.github/skills/sync/menu-sync/SKILL.md +263 -263
  48. package/files/.github/skills/sync/menu-sync/USAGE.md +104 -104
  49. package/files/.github/skills/sync/menu-sync/env/env.local.json +7 -7
  50. package/files/.github/skills/sync/menu-sync/env/guide.md +99 -99
  51. package/files/.github/skills/sync/permission-sync/SKILL.draft.md +91 -91
  52. package/files/.github/standards/01-toolchain.md +57 -57
  53. package/files/.github/standards/02-code-structure.md +111 -111
  54. package/files/.github/standards/03-comments.md +53 -53
  55. package/files/.github/standards/04-coding-basics.md +33 -33
  56. package/files/.github/standards/05-logging.md +38 -38
  57. package/files/.github/standards/06-security.md +44 -44
  58. package/files/.github/standards/07-config.md +52 -52
  59. package/files/.github/standards/08-git.md +60 -60
  60. package/files/.github/standards/09-typescript.md +71 -71
  61. package/files/.github/standards/10-pinia.md +57 -57
  62. package/files/.github/standards/11-form-validation.md +81 -81
  63. package/files/.github/standards/12-base-table.md +153 -153
  64. package/files/.github/standards/13-platform-components.md +123 -123
  65. package/files/.github/standards/index.md +89 -89
  66. package/files/demo/produce/aiflow/mmwr-customer-apply-add/api.md +1 -1
  67. package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/data.ts +196 -196
  68. package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/index.scss +150 -150
  69. package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/index.vue +79 -79
  70. package/files/docs/jh-date-range.md +257 -257
  71. package/files/docs/jh-date.md +222 -222
  72. package/files/docs/jh-dept-picker.md +190 -190
  73. package/files/docs/jh-drag-row.md +590 -590
  74. package/files/docs/jh-file-upload.md +216 -216
  75. package/files/docs/jh-picker.md +218 -218
  76. package/files/docs/jh-select.md +148 -148
  77. package/files/docs/jh-text.md +248 -248
  78. package/files/docs/jh-user-picker.md +197 -197
  79. package/files/docs/request.md +24 -9
  80. package/files/src/components/global/C_RightToolbar/data.ts +228 -0
  81. package/files/src/components/global/C_RightToolbar/index.scss +44 -0
  82. package/files/src/components/global/C_RightToolbar/index.vue +34 -336
  83. package/files/src/components/global/C_Splitter/index.scss +61 -0
  84. package/files/src/components/global/C_Splitter/index.vue +2 -64
  85. package/files/src/components/global/C_SvgIcon/index.scss +15 -0
  86. package/files/src/components/global/C_SvgIcon/index.vue +20 -50
  87. package/files/src/components/global/C_TagStatus/index.scss +20 -0
  88. package/files/src/components/global/C_TagStatus/index.vue +1 -22
  89. package/files/src/components/global/C_Tree/data.ts +61 -0
  90. package/files/src/components/global/C_Tree/index.vue +12 -53
  91. package/files/src/components/local/c_listModal/index.scss +4 -0
  92. package/files/src/components/local/c_listModal/index.vue +1 -1
  93. package/package.json +5 -9
@@ -0,0 +1,44 @@
1
+ :deep(.rightToolBarDialog .el-dialog-body) {
2
+ display: flex !important;
3
+ justify-content: center !important;
4
+ }
5
+ :deep(.el-transfer__button) {
6
+ display: block;
7
+ }
8
+
9
+ :deep(.el-transfer__button:first-child) {
10
+ margin-bottom: 10px;
11
+ }
12
+ :deep(.el-transfer__button:nth-child(2)) {
13
+ margin-left: 0px !important;
14
+ }
15
+
16
+ .my-el-transfer {
17
+ text-align: center;
18
+ }
19
+
20
+ :deep(
21
+ .el-transfer-panel
22
+ .el-transfer-panel__header
23
+ .el-checkbox
24
+ .el-checkbox__label
25
+ span
26
+ ) {
27
+ position: static;
28
+ }
29
+
30
+ :deep(.el-transfer-panel__footer button) {
31
+ position: absolute;
32
+ right: 5px;
33
+ top: 12px;
34
+ }
35
+
36
+ :deep(.el-transfer-panel:first-child .el-checkbox__label) {
37
+ cursor: move !important;
38
+ }
39
+ :deep(.el-transfer-panel) {
40
+ width: 40%;
41
+ }
42
+ :deep(.el-transfer__buttons) {
43
+ width: 20%;
44
+ }
@@ -106,80 +106,23 @@
106
106
 
107
107
  <script setup>
108
108
  import { nextTick } from "vue";
109
- import { postAction, getAction } from "@jhlc/common-core/src/api/action";
110
- import Sortable from "sortablejs";
111
- import { deepClone } from "@/util";
112
109
  import C_OldVersion from "./old-version";
113
- import { useI18n } from "vue-i18n";
110
+ import { createRightToolbar } from "./data";
114
111
 
115
- const { t } = useI18n();
116
- const transferRef = ref(null);
117
112
  const props = defineProps({
118
- // 新版本rightToolbar
119
- proVisible: {
120
- type: Boolean,
121
- default: false
122
- },
123
- showSearch: {
124
- type: Boolean,
125
- default: true
126
- },
127
- columns: {
128
- type: Array
129
- },
130
- // 列表id
131
- tableId: {
132
- type: String
133
- },
134
- // 初始数据
135
- initialColumns: {
136
- type: Array
137
- },
138
- // 后端生成id,第二次后使用
139
- id: {
140
- type: String
141
- },
142
- // 穿梭框右侧数据
143
- propsValue: {
144
- type: Array
145
- },
146
- disabled: {
147
- type: Boolean,
148
- default: false
149
- },
150
- // 控制表格刷新工具按钮显示/隐藏
151
- showRefreshTool: {
152
- type: Boolean,
153
- default: false
154
- },
155
- // 控制显隐搜索栏工具按钮显示/隐藏
156
- showSearchTool: {
157
- type: Boolean,
158
- default: false
159
- },
160
- // 控制动态列表字段工具按钮显示/隐藏
161
- showColumnTool: {
162
- type: Boolean,
163
- default: true
164
- }
113
+ proVisible: { type: Boolean, default: false },
114
+ showSearch: { type: Boolean, default: true },
115
+ columns: { type: Array },
116
+ tableId: { type: String },
117
+ initialColumns: { type: Array },
118
+ id: { type: String },
119
+ propsValue: { type: Array },
120
+ disabled: { type: Boolean, default: false },
121
+ showRefreshTool: { type: Boolean, default: false },
122
+ showSearchTool: { type: Boolean, default: false },
123
+ showColumnTool: { type: Boolean, default: true }
165
124
  });
166
125
 
167
- const modelValue = ref([]);
168
-
169
- watch(
170
- () => props.propsValue,
171
- (newVal) => {
172
- modelValue.value = newVal;
173
- },
174
- { immediate: true }
175
- );
176
-
177
- const columnsProp = computed({
178
- get: () => props.columns
179
- });
180
- const showSearchProp = computed({
181
- get: () => props.showSearch
182
- });
183
126
  const emits = defineEmits([
184
127
  "update:showSearch",
185
128
  "queryTable",
@@ -187,273 +130,28 @@ const emits = defineEmits([
187
130
  "update:propsValue"
188
131
  ]);
189
132
 
190
- const data = ref([]);
191
- // 弹出层标题
192
- const title = ref(t("设置显示字段"));
193
- // 是否显示弹出层
194
- const open = ref(false);
195
- // 显示字段拼接的字符串
196
- const showFields = ref("");
197
- // 隐藏字段拼接的字符串
198
- const hideFields = ref("");
199
- // 初始字段
200
- const defaultColumns = ref([]);
201
- // 保存id
202
- const columnId = ref("");
203
-
204
- const temp = computed(() =>
205
- data.value.filter((item) => {
206
- return item.visible;
207
- })
208
- );
209
- const emitTemp = ref([]);
210
- // 提交loading
211
- const submitLoading = ref(false);
212
-
213
- // 搜索
214
- function toggleSearch() {
215
- emits("update:showSearch", !props.showSearch);
216
- }
217
-
218
- // 刷新
219
- function refresh() {
220
- emits("queryTable");
221
- }
222
- // 关闭弹窗
223
- const closeDialog = () => {
224
- initColumns();
225
- };
226
- // 穿梭变化函数
227
- function dataChange(val) {
228
- if (val) {
229
- data.value.forEach((item) => {
230
- const index = val.findIndex((ele) => ele === item.key);
231
- if (index !== -1) {
232
- item.visible = false;
233
- } else {
234
- item.visible = true;
235
- }
236
- });
237
- }
238
- temp.value = data.value.filter((item) => {
239
- return item.visible;
240
- });
241
- }
242
- // 打开显隐列dialog
243
- function showColumn() {
244
- open.value = true;
245
- data.value = [];
246
- defaultColumns.value = [];
247
- props.columns.forEach((item) => {
248
- defaultColumns.value.push(deepClone(item));
249
- data.value.push(deepClone(item));
250
- });
251
- // 拖动排序
252
- nextTick(() => {
253
- const transfer = transferRef.value.$el;
254
- const leftPanel = transfer
255
- .getElementsByClassName("el-transfer-panel")[0]
256
- .getElementsByClassName("el-transfer-panel__body")[0];
257
- const leftEl = leftPanel.getElementsByClassName(
258
- "el-transfer-panel__list"
259
- )[0];
260
- Sortable.create(leftEl, {
261
- onEnd: (evt) => {
262
- const { oldIndex, newIndex } = evt;
263
- temp.value = data.value.filter((item) => {
264
- return item.visible;
265
- });
266
- let _arr = temp.value.splice(oldIndex, 1);
267
- temp.value.splice(newIndex, 0, _arr[0]);
268
- let arr = [];
269
- temp.value.forEach((item) => arr.push(item));
270
- data.value.forEach((item) => {
271
- if (item.visible == false) {
272
- arr.push(item);
273
- }
274
- });
275
- data.value = [];
276
- arr.forEach((item) => {
277
- data.value.push(item);
278
- });
279
- }
280
- });
281
- });
282
- }
283
-
284
- // 恢复方法
285
- function recoverTool(recoverData) {
286
- let dataTemp = [];
287
- let modelValueTemp = [];
288
- recoverData.forEach((item) => {
289
- dataTemp.push(deepClone(item));
290
- if (!item.visible) {
291
- modelValueTemp.push(item.key);
292
- }
293
- });
294
- data.value = dataTemp;
295
- modelValue.value = modelValueTemp;
296
- }
297
- // 穿梭框左侧恢复默认按钮
298
- function initColumns() {
299
- recoverTool(defaultColumns.value);
300
- }
301
- // 穿梭框右侧清空按钮
302
- function clearValue() {
303
- recoverTool(props.initialColumns);
304
- }
305
-
306
- function cancelBtn() {
307
- initColumns();
308
- open.value = false;
309
- }
310
-
311
- // 保存配置
312
- function submitBtn() {
313
- showFields.value = "";
314
- hideFields.value = "";
315
- temp.value.forEach((item) => {
316
- showFields.value += `${item.key},`;
317
- });
318
- hideFields.value = modelValue.value.join();
319
- let paramsList = {
320
- id: columnId.value || props.id,
321
- tableId: props.tableId,
322
- showFields: showFields.value,
323
- hideFields: hideFields.value
324
- };
325
- submitLoading.value = true;
326
- postAction("system/pageShowFields/saveOrUpdate", paramsList)
327
- .then((res) => {
328
- temp.value.forEach((item) => {
329
- emitTemp.value.push(item);
330
- });
331
- data.value.forEach((item) => {
332
- if (!item.visible) {
333
- emitTemp.value.push(item);
334
- }
335
- });
336
- columnId.value = res.data.id;
337
- emits("update:columns", emitTemp.value);
338
- emits("update:propsValue", modelValue.value);
339
- emitTemp.value = [];
340
- })
341
- .catch(() => initColumns())
342
- .finally(() => {
343
- submitLoading.value = false;
344
- open.value = false;
345
- });
346
- }
347
-
348
- // 获取配置的列表字段信息
349
- function getColumns(columnsInfo) {
350
- const _columnsInfo = deepClone(columnsInfo);
351
- _columnsInfo.propsValue = [];
352
- return getAction(
353
- `/system/pageShowFields/getByTableIdAndUserNo?tableId=${_columnsInfo.tableId}`
354
- ).then((res) => {
355
- if (res.data) {
356
- _columnsInfo.id = res.data.id;
357
- // 显示字段
358
- let showArr;
359
- if (res.data.showFields) {
360
- showArr = res.data.showFields.split(",");
361
- }
362
-
363
- // 隐藏字段
364
- let hideArr;
365
- if (res.data.hideFields) {
366
- hideArr = res.data.hideFields.split(",");
367
- }
368
- // 排序
369
- let flag = [];
370
- flag = showArr.reduce((res, item) => {
371
- const value = _columnsInfo.columns.find((val) => val.key === item);
372
- if (!value) {
373
- return res;
374
- }
375
- res.push(value);
376
- return res;
377
- }, []);
378
- let result = [...new Set(flag.concat(_columnsInfo.columns))];
379
- _columnsInfo.columns = [];
380
- result.forEach((item) => {
381
- _columnsInfo.columns.push(item);
382
- });
383
- _columnsInfo.columns.forEach((item) => {
384
- if (showArr) {
385
- const index1 = showArr.findIndex((val) => val === item.key);
386
- if (index1 !== -1) {
387
- item.visible = true;
388
- }
389
- }
390
- if (hideArr) {
391
- const index2 = hideArr.findIndex((val) => val === item.key);
392
- if (index2 !== -1) {
393
- item.visible = false;
394
- }
395
- }
396
- });
397
- // 右侧隐藏数据
398
- if (hideArr) {
399
- hideArr.forEach((item) => {
400
- _columnsInfo.propsValue.push(item);
401
- });
402
- }
403
-
404
- return _columnsInfo;
405
- }
406
- });
407
- }
408
-
409
- defineExpose({
133
+ const {
134
+ transferRef,
135
+ data,
136
+ title,
137
+ open,
138
+ modelValue,
139
+ columnsProp,
140
+ showSearchProp,
141
+ submitLoading,
142
+ toggleSearch,
143
+ refresh,
144
+ closeDialog,
145
+ dataChange,
146
+ showColumn,
147
+ initColumns,
148
+ clearValue,
149
+ cancelBtn,
150
+ submitBtn,
410
151
  getColumns
411
- });
412
- </script>
152
+ } = createRightToolbar(props, emits);
413
153
 
414
- <style lang="scss" scoped>
415
- :deep(.rightToolBarDialog .el-dialog-body) {
416
- display: flex !important;
417
- justify-content: center !important;
418
- }
419
- :deep(.el-transfer__button) {
420
- display: block;
421
- }
422
-
423
- :deep(.el-transfer__button:first-child) {
424
- margin-bottom: 10px;
425
- }
426
- :deep(.el-transfer__button:nth-child(2)) {
427
- margin-left: 0px !important;
428
- }
429
-
430
- .my-el-transfer {
431
- text-align: center;
432
- }
433
-
434
- :deep(
435
- .el-transfer-panel
436
- .el-transfer-panel__header
437
- .el-checkbox
438
- .el-checkbox__label
439
- span
440
- ) {
441
- position: static;
442
- }
443
-
444
- :deep(.el-transfer-panel__footer button) {
445
- position: absolute;
446
- right: 5px;
447
- top: 12px;
448
- }
154
+ defineExpose({ getColumns });
155
+ </script>
449
156
 
450
- :deep(.el-transfer-panel:first-child .el-checkbox__label) {
451
- cursor: move !important;
452
- }
453
- :deep(.el-transfer-panel) {
454
- width: 40%;
455
- }
456
- :deep(.el-transfer__buttons) {
457
- width: 20%;
458
- }
459
- </style>
157
+ <style lang="scss" scoped src="./index.scss"></style>
@@ -0,0 +1,61 @@
1
+ .my-splitter-container {
2
+ display: flex;
3
+ width: 100%;
4
+ height: 100%;
5
+ overflow: hidden;
6
+ }
7
+
8
+ .is-horizontal {
9
+ flex-direction: row;
10
+ }
11
+ .is-vertical {
12
+ flex-direction: column;
13
+ }
14
+
15
+ .splitter-item {
16
+ overflow: auto;
17
+ }
18
+
19
+ .splitter-trigger {
20
+ background-color: #f0f2f5;
21
+ display: flex;
22
+ align-items: center;
23
+ justify-content: center;
24
+ transition: background-color 0.2s;
25
+ z-index: 10;
26
+ }
27
+
28
+ .splitter-trigger:hover {
29
+ background-color: #409eff;
30
+ }
31
+
32
+ /* 水平线 */
33
+ .is-horizontal > .splitter-trigger {
34
+ width: 4px;
35
+ cursor: col-resize;
36
+ }
37
+ .is-horizontal .trigger-line {
38
+ width: 1px;
39
+ height: 20px;
40
+ background: #dcdfe6;
41
+ }
42
+
43
+ /* 垂直线 */
44
+ .is-vertical > .splitter-trigger {
45
+ height: 8px;
46
+ cursor: row-resize;
47
+ background-color: #f5f5f5;
48
+ flex-shrink: 0;
49
+ display: flex;
50
+ align-items: center;
51
+ justify-content: center;
52
+ }
53
+ .is-vertical .trigger-line {
54
+ width: 30px;
55
+ height: 3px;
56
+ background: #d9d9d9;
57
+ border-radius: 2px;
58
+ }
59
+ .is-vertical > .splitter-trigger:hover .trigger-line {
60
+ background: #409eff;
61
+ }
@@ -127,69 +127,7 @@ const onMouseUp = () => {
127
127
  window.removeEventListener("mouseup", onMouseUp);
128
128
  };
129
129
 
130
- onUnmounted(() => onMouseUp());
130
+ onUnmounted(() => onMouseUp())
131
131
  </script>
132
132
 
133
- <style scoped>
134
- .my-splitter-container {
135
- display: flex;
136
- width: 100%;
137
- height: 100%;
138
- overflow: hidden;
139
- }
140
-
141
- .is-horizontal {
142
- flex-direction: row;
143
- }
144
- .is-vertical {
145
- flex-direction: column;
146
- }
147
-
148
- .splitter-item {
149
- overflow: auto;
150
- }
151
-
152
- .splitter-trigger {
153
- background-color: #f0f2f5;
154
- display: flex;
155
- align-items: center;
156
- justify-content: center;
157
- transition: background-color 0.2s;
158
- z-index: 10;
159
- }
160
-
161
- .splitter-trigger:hover {
162
- background-color: #409eff;
163
- }
164
-
165
- /* 水平线 */
166
- .is-horizontal > .splitter-trigger {
167
- width: 4px;
168
- cursor: col-resize;
169
- }
170
- .is-horizontal .trigger-line {
171
- width: 1px;
172
- height: 20px;
173
- background: #dcdfe6;
174
- }
175
-
176
- /* 垂直线 */
177
- .is-vertical > .splitter-trigger {
178
- height: 8px;
179
- cursor: row-resize;
180
- background-color: #f5f5f5;
181
- flex-shrink: 0;
182
- display: flex;
183
- align-items: center;
184
- justify-content: center;
185
- }
186
- .is-vertical .trigger-line {
187
- width: 30px;
188
- height: 3px;
189
- background: #d9d9d9;
190
- border-radius: 2px;
191
- }
192
- .is-vertical > .splitter-trigger:hover .trigger-line {
193
- background: #409eff;
194
- }
195
- </style>
133
+ <style scoped src="./index.scss"></style>
@@ -0,0 +1,15 @@
1
+ .sub-el-icon,
2
+ .nav-icon {
3
+ display: inline-block;
4
+ font-size: 15px;
5
+ margin-right: 12px;
6
+ position: relative;
7
+ }
8
+
9
+ .svg-icon {
10
+ width: 1em;
11
+ height: 1em;
12
+ position: relative;
13
+ fill: currentColor;
14
+ vertical-align: -2px;
15
+ }
@@ -4,58 +4,28 @@
4
4
  </svg>
5
5
  </template>
6
6
 
7
- <script>
7
+ <script setup lang="ts">
8
+ import { computed, onMounted, onUpdated } from 'vue'
8
9
  import { addSymbolDelay } from '@jhlc/common-resource/src/svg/register-static-svg'
9
10
 
10
- export default {
11
- props: {
12
- iconClass: {
13
- type: String,
14
- required: true
15
- },
16
- className: {
17
- type: String,
18
- default: ''
19
- },
20
- color: {
21
- type: String,
22
- default: ''
23
- },
24
- },
25
- beforeCreate() {
26
- addSymbolDelay(this.iconClass)
27
- },
28
- updated() {
29
- addSymbolDelay(this.iconClass)
30
- },
31
- setup(props) {
32
- return {
33
- iconName: computed(() => `#icon-${props.iconClass}`),
34
- svgClass: computed(() => {
35
- if (props.className) {
36
- return `svg-icon ${props.className}`
37
- }
38
- return 'svg-icon'
39
- })
40
- }
41
- }
11
+ interface Props {
12
+ iconClass: string
13
+ className?: string
14
+ color?: string
42
15
  }
43
- </script>
44
16
 
45
- <style scope lang="scss">
46
- .sub-el-icon,
47
- .nav-icon {
48
- display: inline-block;
49
- font-size: 15px;
50
- margin-right: 12px;
51
- position: relative;
52
- }
17
+ const props = withDefaults(defineProps<Props>(), {
18
+ className: '',
19
+ color: ''
20
+ })
53
21
 
54
- .svg-icon {
55
- width: 1em;
56
- height: 1em;
57
- position: relative;
58
- fill: currentColor;
59
- vertical-align: -2px;
60
- }
61
- </style>
22
+ const iconName = computed(() => `#icon-${props.iconClass}`)
23
+ const svgClass = computed(() =>
24
+ props.className ? `svg-icon ${props.className}` : 'svg-icon'
25
+ )
26
+
27
+ onMounted(() => addSymbolDelay(props.iconClass))
28
+ onUpdated(() => addSymbolDelay(props.iconClass))
29
+ </script>
30
+
31
+ <style scoped lang="scss" src="./index.scss"></style>
@@ -0,0 +1,20 @@
1
+ .status-fallback {
2
+ display: inline-block;
3
+ padding: 0 8px;
4
+ font-size: 12px;
5
+ color: #909399;
6
+ line-height: 22px;
7
+ white-space: nowrap;
8
+ }
9
+
10
+ // 增强 el-tag 的视觉效果
11
+ :deep(.el-tag) {
12
+ font-weight: 500;
13
+ border: none;
14
+
15
+ // 为淡色效果添加边框
16
+ &.el-tag--light {
17
+ border: 1px solid currentColor;
18
+ border-color: var(--el-tag-border-color);
19
+ }
20
+ }
@@ -103,25 +103,4 @@ const handleClose = (event: MouseEvent) => {
103
103
  };
104
104
  </script>
105
105
 
106
- <style scoped lang="scss">
107
- .status-fallback {
108
- display: inline-block;
109
- padding: 0 8px;
110
- font-size: 12px;
111
- color: #909399;
112
- line-height: 22px;
113
- white-space: nowrap;
114
- }
115
-
116
- // 增强 el-tag 的视觉效果
117
- :deep(.el-tag) {
118
- font-weight: 500;
119
- border: none;
120
-
121
- // 为淡色效果添加边框
122
- &.el-tag--light {
123
- border: 1px solid currentColor;
124
- border-color: var(--el-tag-border-color);
125
- }
126
- }
127
- </style>
106
+ <style scoped lang="scss" src="./index.scss"></style>