king-design-analyzer 2.1.9 → 2.2.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.
- package/components/actions.json +109 -0
- package/components/advancedset.json +128 -0
- package/components/affix.json +8 -0
- package/components/aksk.json +172 -0
- package/components/anchor.json +220 -0
- package/components/anchorlink.json +111 -0
- package/components/az.json +15 -2
- package/components/badge.json +8 -0
- package/components/billtypes.json +14 -2
- package/components/breadcrumb.json +9 -1
- package/components/button.json +192 -0
- package/components/buttonlink.json +74 -0
- package/components/card.json +14 -4
- package/components/cardcol.json +142 -0
- package/components/cardcols.json +121 -0
- package/components/cardcontent.json +20 -3
- package/components/cardtabs.json +172 -0
- package/components/carousel.json +7 -0
- package/components/cascader.json +576 -368
- package/components/checkbox.json +51 -4
- package/components/cidrinput.json +140 -0
- package/components/code.json +8 -1
- package/components/collapse.json +335 -341
- package/components/colorpicker.json +217 -0
- package/components/configprovider.json +96 -0
- package/components/copy.json +7 -0
- package/components/copyhover.json +111 -0
- package/components/copyrow.json +125 -0
- package/components/datepicker.json +656 -524
- package/components/description.json +98 -0
- package/components/descriptions.json +10 -3
- package/components/diagram.json +295 -0
- package/components/dialog.json +526 -455
- package/components/divider.json +9 -1
- package/components/drawer.json +603 -558
- package/components/dropdown.json +464 -384
- package/components/duration.json +125 -0
- package/components/editable.json +66 -0
- package/components/ellipsis.json +34 -1
- package/components/filtertablefieldsdialog.json +128 -0
- package/components/flex.json +152 -0
- package/components/form.json +143 -3
- package/components/formiteminput.json +214 -0
- package/components/formitemspinner.json +213 -0
- package/components/formitemswitch.json +185 -0
- package/components/formitemtableconfigs.json +210 -0
- package/components/grid.json +7 -0
- package/components/header.json +165 -0
- package/components/icon.json +13 -1
- package/components/icontooltip.json +19 -1
- package/components/input.json +196 -8
- package/components/instancelist.json +194 -0
- package/components/instancenum.json +196 -0
- package/components/ipinput.json +117 -0
- package/components/kspstatus.json +205 -0
- package/components/kvcode.json +120 -0
- package/components/layoutcontent.json +24 -3
- package/components/layoutlistcontent.json +157 -0
- package/components/layoutpermissioncontent.json +156 -0
- package/components/layoutstandardlist.json +276 -0
- package/components/layouttabs.json +168 -0
- package/components/lazymount.json +87 -0
- package/components/lazyteleport.json +119 -0
- package/components/menu.json +11 -3
- package/components/notification.json +351 -0
- package/components/pagination.json +12 -0
- package/components/paginationplus.json +30 -3
- package/components/password.json +121 -0
- package/components/popover.json +457 -437
- package/components/projects.json +129 -0
- package/components/protable.json +99 -8
- package/components/queuevisualrange.json +110 -0
- package/components/radio.json +82 -2
- package/components/rate.json +200 -0
- package/components/region.json +14 -2
- package/components/scrollselect.json +140 -0
- package/components/search.json +221 -0
- package/components/searchinput.json +132 -0
- package/components/searchitems.json +215 -0
- package/components/searchselect.json +195 -0
- package/components/select.json +749 -666
- package/components/sidebar.json +198 -0
- package/components/skeleton.json +234 -0
- package/components/slider.json +12 -2
- package/components/spin.json +10 -2
- package/components/spinner.json +419 -429
- package/components/split.json +263 -0
- package/components/sshkeys.json +138 -0
- package/components/status.json +60 -3
- package/components/steps.json +7 -0
- package/components/switch.json +12 -3
- package/components/table.json +24 -2
- package/components/tablecolumnid.json +14 -2
- package/components/tabs.json +14 -2
- package/components/tag.json +8 -5
- package/components/timeline.json +215 -0
- package/components/timepicker.json +147 -3
- package/components/timerange.json +262 -0
- package/components/tip.json +27 -0
- package/components/tooltip.json +492 -395
- package/components/tour.json +418 -372
- package/components/transfer.json +79 -8
- package/components/tree.json +28 -5
- package/components/treeselect.json +612 -475
- package/components/upload.json +474 -473
- package/components/vdialog.json +309 -0
- package/components/vdrawer.json +335 -0
- package/components/virtuallist.json +7 -0
- package/dist/ast/index.d.mts +65 -2
- package/dist/ast/index.d.ts +65 -2
- package/dist/ast/index.js +4 -3
- package/dist/ast/index.mjs +2 -1
- package/dist/chunk-4OTQAQ6J.mjs +341 -0
- package/dist/{chunk-F26GUCGG.js → chunk-4WXOYU2N.js} +32 -9
- package/dist/chunk-6HOIRUQB.mjs +409 -0
- package/dist/chunk-DHLWNT53.js +364 -0
- package/dist/{chunk-H2ET6MMM.mjs → chunk-IPJJMPOO.mjs} +155 -66
- package/dist/{chunk-WYSRJVX4.js → chunk-JJ6AB4ZH.js} +2 -2
- package/dist/{chunk-2W6OCG2S.js → chunk-JNRGUR3O.js} +155 -67
- package/dist/chunk-KF5YBEM5.js +143 -0
- package/dist/{chunk-OJOHB64C.mjs → chunk-LRTDTFFQ.mjs} +28 -5
- package/dist/{chunk-DSWKLUIX.mjs → chunk-NZL6T22V.mjs} +1 -1
- package/dist/chunk-QC6VTSA3.mjs +117 -0
- package/dist/chunk-V5N65MRP.js +411 -0
- package/dist/full/index.d.mts +2 -0
- package/dist/full/index.d.ts +2 -0
- package/dist/full/index.js +7 -6
- package/dist/full/index.mjs +5 -4
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +14 -13
- package/dist/index.mjs +6 -5
- package/dist/metadata/index.d.mts +38 -3
- package/dist/metadata/index.d.ts +38 -3
- package/dist/metadata/index.js +26 -16
- package/dist/metadata/index.mjs +26 -15
- package/dist/resolve-BsLBxlBi.d.mts +24 -0
- package/dist/resolve-BsLBxlBi.d.ts +24 -0
- package/dist/runtime/index.d.mts +2 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +4 -4
- package/dist/runtime/index.mjs +2 -2
- package/dist/shared/index.d.mts +10 -0
- package/dist/shared/index.d.ts +10 -0
- package/dist/shared/index.js +23 -0
- package/dist/shared/index.mjs +2 -0
- package/dist/static/index.js +5 -5
- package/dist/static/index.mjs +2 -2
- package/docs_for_llm/actions.doc.md +87 -0
- package/docs_for_llm/advancedset.doc.md +98 -0
- package/docs_for_llm/affix.doc.md +20 -7
- package/docs_for_llm/aksk.doc.md +111 -0
- package/docs_for_llm/anchor.doc.md +155 -0
- package/docs_for_llm/anchorlink.doc.md +75 -0
- package/docs_for_llm/az.doc.md +17 -11
- package/docs_for_llm/badge.doc.md +11 -5
- package/docs_for_llm/billtypes.doc.md +17 -11
- package/docs_for_llm/breadcrumb.doc.md +80 -4
- package/docs_for_llm/button.doc.md +91 -18
- package/docs_for_llm/buttonlink.doc.md +64 -0
- package/docs_for_llm/card.doc.md +58 -8
- package/docs_for_llm/cardcol.doc.md +78 -0
- package/docs_for_llm/cardcols.doc.md +84 -0
- package/docs_for_llm/cardcontent.doc.md +31 -10
- package/docs_for_llm/cardtabs.doc.md +106 -0
- package/docs_for_llm/carousel.doc.md +79 -7
- package/docs_for_llm/cascader.doc.md +106 -23
- package/docs_for_llm/checkbox.doc.md +25 -13
- package/docs_for_llm/cidrinput.doc.md +83 -0
- package/docs_for_llm/code.doc.md +22 -11
- package/docs_for_llm/collapse.doc.md +147 -14
- package/docs_for_llm/colorpicker.doc.md +104 -0
- package/docs_for_llm/configprovider.doc.md +77 -0
- package/docs_for_llm/copy.doc.md +15 -13
- package/docs_for_llm/copyhover.doc.md +59 -0
- package/docs_for_llm/copyrow.doc.md +80 -0
- package/docs_for_llm/datepicker.doc.md +66 -35
- package/docs_for_llm/description.doc.md +75 -0
- package/docs_for_llm/descriptions.doc.md +122 -10
- package/docs_for_llm/diagram.doc.md +343 -0
- package/docs_for_llm/dialog.doc.md +97 -77
- package/docs_for_llm/divider.doc.md +14 -7
- package/docs_for_llm/drawer.doc.md +114 -69
- package/docs_for_llm/dropdown.doc.md +290 -22
- package/docs_for_llm/duration.doc.md +76 -0
- package/docs_for_llm/editable.doc.md +36 -14
- package/docs_for_llm/ellipsis.doc.md +10 -5
- package/docs_for_llm/filtertablefieldsdialog.doc.md +99 -0
- package/docs_for_llm/flex.doc.md +83 -0
- package/docs_for_llm/form.doc.md +196 -18
- package/docs_for_llm/formiteminput.doc.md +128 -0
- package/docs_for_llm/formitemspinner.doc.md +105 -0
- package/docs_for_llm/formitemswitch.doc.md +113 -0
- package/docs_for_llm/formitemtableconfigs.doc.md +95 -0
- package/docs_for_llm/grid.doc.md +78 -5
- package/docs_for_llm/header.doc.md +114 -0
- package/docs_for_llm/icon.doc.md +12 -8
- package/docs_for_llm/icontooltip.doc.md +121 -0
- package/docs_for_llm/input.doc.md +199 -41
- package/docs_for_llm/instancelist.doc.md +113 -0
- package/docs_for_llm/instancenum.doc.md +95 -0
- package/docs_for_llm/ipinput.doc.md +77 -0
- package/docs_for_llm/kspstatus.doc.md +82 -0
- package/docs_for_llm/kvcode.doc.md +76 -0
- package/docs_for_llm/layoutcontent.doc.md +54 -17
- package/docs_for_llm/layoutlistcontent.doc.md +168 -0
- package/docs_for_llm/layoutpermissioncontent.doc.md +93 -0
- package/docs_for_llm/layoutstandardlist.doc.md +129 -0
- package/docs_for_llm/layouttabs.doc.md +101 -0
- package/docs_for_llm/lazymount.doc.md +82 -0
- package/docs_for_llm/lazyteleport.doc.md +85 -0
- package/docs_for_llm/menu.doc.md +139 -14
- package/docs_for_llm/message.doc.md +93 -10
- package/docs_for_llm/notification.doc.md +214 -0
- package/docs_for_llm/pagination.doc.md +30 -17
- package/docs_for_llm/paginationplus.doc.md +31 -10
- package/docs_for_llm/password.doc.md +86 -0
- package/docs_for_llm/popover.doc.md +24 -55
- package/docs_for_llm/progress.doc.md +13 -10
- package/docs_for_llm/projects.doc.md +91 -0
- package/docs_for_llm/protable.doc.md +98 -15
- package/docs_for_llm/queuevisualrange.doc.md +78 -0
- package/docs_for_llm/radio.doc.md +23 -8
- package/docs_for_llm/rate.doc.md +127 -0
- package/docs_for_llm/region.doc.md +25 -13
- package/docs_for_llm/scrollselect.doc.md +90 -0
- package/docs_for_llm/search.doc.md +120 -0
- package/docs_for_llm/searchinput.doc.md +111 -0
- package/docs_for_llm/searchitems.doc.md +116 -0
- package/docs_for_llm/searchselect.doc.md +126 -0
- package/docs_for_llm/select.doc.md +208 -49
- package/docs_for_llm/sidebar.doc.md +133 -0
- package/docs_for_llm/skeleton.doc.md +152 -0
- package/docs_for_llm/slider.doc.md +42 -22
- package/docs_for_llm/spin.doc.md +18 -6
- package/docs_for_llm/spinner.doc.md +28 -18
- package/docs_for_llm/split.doc.md +170 -0
- package/docs_for_llm/sshkeys.doc.md +88 -0
- package/docs_for_llm/status.doc.md +14 -9
- package/docs_for_llm/steps.doc.md +81 -7
- package/docs_for_llm/switch.doc.md +32 -16
- package/docs_for_llm/table.doc.md +317 -55
- package/docs_for_llm/tablecolumnid.doc.md +36 -16
- package/docs_for_llm/tabs.doc.md +117 -12
- package/docs_for_llm/tag.doc.md +167 -15
- package/docs_for_llm/timeline.doc.md +187 -0
- package/docs_for_llm/timepicker.doc.md +74 -36
- package/docs_for_llm/timerange.doc.md +157 -0
- package/docs_for_llm/tip.doc.md +50 -11
- package/docs_for_llm/tooltip.doc.md +99 -27
- package/docs_for_llm/tour.doc.md +125 -28
- package/docs_for_llm/transfer.doc.md +99 -33
- package/docs_for_llm/tree.doc.md +129 -24
- package/docs_for_llm/treeselect.doc.md +101 -44
- package/docs_for_llm/upload.doc.md +63 -32
- package/docs_for_llm/useCRUD.doc.md +49 -0
- package/docs_for_llm/useCountdown.doc.md +43 -0
- package/docs_for_llm/useDetail.doc.md +48 -0
- package/docs_for_llm/useDialog.doc.md +46 -0
- package/docs_for_llm/useEntity.doc.md +45 -0
- package/docs_for_llm/useEventListener.doc.md +44 -0
- package/docs_for_llm/useFalseUntilTruthy.doc.md +41 -0
- package/docs_for_llm/useGetCopyAuthText.doc.md +35 -0
- package/docs_for_llm/useGetUserPermission.doc.md +43 -0
- package/docs_for_llm/useGroup.doc.md +48 -0
- package/docs_for_llm/useIdEntities.doc.md +48 -0
- package/docs_for_llm/useIdEntity.doc.md +103 -0
- package/docs_for_llm/useInterval.doc.md +43 -0
- package/docs_for_llm/useLayoutStandardList.doc.md +38 -0
- package/docs_for_llm/useMessage.doc.md +46 -0
- package/docs_for_llm/useModifyCache.doc.md +37 -0
- package/docs_for_llm/useOpenDialog.doc.md +41 -0
- package/docs_for_llm/usePagination.doc.md +60 -0
- package/docs_for_llm/usePersist.doc.md +54 -0
- package/docs_for_llm/usePoll.doc.md +41 -0
- package/docs_for_llm/useRoutePlus.doc.md +34 -0
- package/docs_for_llm/useRouterPlus.doc.md +34 -0
- package/docs_for_llm/useSearch.doc.md +68 -0
- package/docs_for_llm/useShell.doc.md +43 -0
- package/docs_for_llm/useSkip.doc.md +41 -0
- package/docs_for_llm/useStorageIdEntity.doc.md +46 -0
- package/docs_for_llm/useStore.doc.md +34 -0
- package/docs_for_llm/useTable.doc.md +57 -0
- package/docs_for_llm/useTableGroup.doc.md +47 -0
- package/docs_for_llm/useTableSort.doc.md +40 -0
- package/docs_for_llm/useToState.doc.md +112 -0
- package/docs_for_llm/useUser.doc.md +38 -0
- package/docs_for_llm/useValidForm.doc.md +41 -0
- package/docs_for_llm/vdialog.doc.md +154 -0
- package/docs_for_llm/vdrawer.doc.md +148 -0
- package/docs_for_llm/virtuallist.doc.md +157 -3
- package/hooks/useCRUD.json +61 -0
- package/hooks/useCountdown.json +49 -0
- package/hooks/useDetail.json +67 -0
- package/hooks/useDialog.json +49 -0
- package/hooks/useEntity.json +61 -0
- package/hooks/useEventListener.json +61 -0
- package/hooks/useFalseUntilTruthy.json +43 -0
- package/hooks/useGetCopyAuthText.json +36 -0
- package/hooks/useGetUserPermission.json +55 -0
- package/hooks/useGroup.json +49 -0
- package/hooks/useIdEntities.json +61 -0
- package/hooks/useInterval.json +55 -0
- package/hooks/useLayoutStandardList.json +36 -0
- package/hooks/useMessage.json +73 -0
- package/hooks/useModifyCache.json +36 -0
- package/hooks/useOpenDialog.json +43 -0
- package/hooks/usePagination.json +49 -0
- package/hooks/usePersist.json +61 -0
- package/hooks/usePoll.json +43 -0
- package/hooks/useRoutePlus.json +36 -0
- package/hooks/useRouterPlus.json +36 -0
- package/hooks/useSearch.json +56 -0
- package/hooks/useShell.json +49 -0
- package/hooks/useSkip.json +43 -0
- package/hooks/useStorageIdEntity.json +67 -0
- package/hooks/useStore.json +36 -0
- package/hooks/useTable.json +49 -0
- package/hooks/useTableGroup.json +43 -0
- package/hooks/useTableSort.json +43 -0
- package/hooks/useUser.json +36 -0
- package/hooks/useValidForm.json +43 -0
- package/package.json +14 -8
- package/dist/chunk-D3Y6FGWA.js +0 -153
- package/dist/chunk-HPAUCD5I.js +0 -156
- package/dist/chunk-L4DS3EXI.mjs +0 -133
- package/dist/chunk-NZ6TLWMD.mjs +0 -151
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
显示状态图标和文本,支持旋转动画。
|
|
4
4
|
|
|
5
|
-
**关键词**: status, indicator, loading,
|
|
5
|
+
**关键词**: status, indicator, loading, 状态, 状态指示器, 加载状态, 进度状态
|
|
6
6
|
|
|
7
|
-
**使用场景**:
|
|
7
|
+
**使用场景**: 表格行状态展示、详情页资源状态、带进度的任务状态展示、支持刷新动作的状态提示
|
|
8
8
|
|
|
9
9
|
## 导入语句
|
|
10
10
|
```typescript
|
|
@@ -12,11 +12,16 @@ import { Status } from '@ksyun-internal/versatile';
|
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
## 属性 (Props)
|
|
15
|
-
| 属性名 | 类型 | 默认值 | 必填 | 说明 | 示例 |
|
|
16
|
-
| --- | --- | --- | --- | --- | --- |
|
|
17
|
-
| type | `StatusType` | `undefined` | 否 | 状态类型 | - |
|
|
18
|
-
| color | `string` | `undefined` | 否 | 自定义颜色 | - |
|
|
19
|
-
| text | `string` | `undefined` | 否 | 状态文本 | - |
|
|
20
|
-
| rotate | `boolean` | `undefined` | 否 | 是否旋转图标 | - |
|
|
21
|
-
|
|
|
15
|
+
| 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
|
|
16
|
+
| --- | --- | --- | --- | --- | --- | --- |
|
|
17
|
+
| type | `StatusType` | `undefined` | 否 | 状态类型 | - | - |
|
|
18
|
+
| color | `string` | `undefined` | 否 | 自定义颜色 | - | - |
|
|
19
|
+
| text | `string` | `undefined` | 否 | 状态文本 | - | - |
|
|
20
|
+
| rotate | `boolean` | `undefined` | 否 | 是否旋转图标 | - | - |
|
|
21
|
+
| rotationDuration | `string | number` | `undefined` | 否 | 旋转动画时长,支持字符串或数字 | - | - |
|
|
22
|
+
| refresh | `() => Promise<void>` | `undefined` | 否 | 刷新函数,传递此属性时会显示刷新按钮 | - | - |
|
|
23
|
+
| tip | `string` | `undefined` | 否 | 状态说明提示文案 | - | - |
|
|
24
|
+
| progress | `number` | `undefined` | 否 | 进度值,传入后可展示带进度语义的状态 | - | - |
|
|
25
|
+
| refreshTip | `string` | `undefined` | 否 | 刷新按钮的 tooltip 文案 | - | - |
|
|
26
|
+
| position | `"left" | "right" | "top" | "bottom" | Options` | `undefined` | 否 | 状态提示或刷新按钮的弹出位置 | - | - |
|
|
22
27
|
|
|
@@ -12,33 +12,107 @@ import { Steps, Step } from '@king-design/vue';
|
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
## 属性 (Props)
|
|
15
|
-
| 属性名 | 类型 | 默认值 | 必填 | 说明 | 示例 |
|
|
16
|
-
| --- | --- | --- | --- | --- | --- |
|
|
17
|
-
| value | `number` | `undefined` | 否 | 当前第几步,从 0 开始,可用 v-model 双向绑定 | `<Steps :value="current"></Steps>` |
|
|
18
|
-
| status | `"normal" | "error"` | `"normal"` | 否 | 步骤条的状态 | `<Steps status="error"></Steps>` |
|
|
19
|
-
| type | `"default" | "line" | "simple" | "line-compact"` | `"default"` | 否 | 步骤条样式 | `<Steps type="line"></Steps>` |
|
|
20
|
-
| clickable | `boolean` | `false` | 否 | 是否支持快速切换已完成的步骤 | `<Steps v-model="current" clickable></Steps>` |
|
|
21
|
-
| vertical | `boolean` | `false` | 否 | 是否垂直排列 | `<Steps vertical></Steps>` |
|
|
15
|
+
| 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
|
|
16
|
+
| --- | --- | --- | --- | --- | --- | --- |
|
|
17
|
+
| value | `number` | `undefined` | 否 | 当前第几步,从 0 开始,可用 v-model 双向绑定 | - | `<Steps :value="current"></Steps>` |
|
|
18
|
+
| status | `"normal" | "error"` | `"normal"` | 否 | 步骤条的状态 | - | `<Steps status="error"></Steps>` |
|
|
19
|
+
| type | `"default" | "line" | "simple" | "line-compact"` | `"default"` | 否 | 步骤条样式 | - | `<Steps type="line"></Steps>` |
|
|
20
|
+
| clickable | `boolean` | `false` | 否 | 是否支持快速切换已完成的步骤 | - | `<Steps v-model="current" clickable></Steps>` |
|
|
21
|
+
| vertical | `boolean` | `false` | 否 | 是否垂直排列 | - | `<Steps vertical></Steps>` |
|
|
22
22
|
|
|
23
23
|
## 子组件 (Sub-Components)
|
|
24
24
|
### Step
|
|
25
25
|
步骤项组件,用于定义每个步骤的标题和内容
|
|
26
26
|
|
|
27
|
+
#### 属性 (Props)
|
|
27
28
|
| 属性名 | 类型 | 说明 | 示例 |
|
|
28
29
|
| --- | --- | --- | --- |
|
|
29
30
|
| title | `string` | 步骤标题 | `<Step title="步骤1" />` |
|
|
30
31
|
|
|
32
|
+
#### 组合示例
|
|
33
|
+
##### 基础用法
|
|
34
|
+
**场景**: 创建一个基本的步骤条
|
|
35
|
+
|
|
36
|
+
基本的步骤条
|
|
37
|
+
|
|
38
|
+
**命中的子组件 API**: 属性: title
|
|
39
|
+
|
|
40
|
+
```vue
|
|
41
|
+
<script setup lang="ts">
|
|
42
|
+
import { ref } from 'vue';
|
|
43
|
+
import { Steps, Step } from '@king-design/vue';
|
|
44
|
+
|
|
45
|
+
const current = ref(1);
|
|
46
|
+
</script>
|
|
47
|
+
<template>
|
|
48
|
+
<Steps :value="current">
|
|
49
|
+
<Step title="步骤1" />
|
|
50
|
+
<Step title="步骤2" />
|
|
51
|
+
<Step title="步骤3" />
|
|
52
|
+
</Steps>
|
|
53
|
+
</template>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
##### 可点击切换
|
|
57
|
+
**场景**: 可以点击已完成的步骤进行切换
|
|
58
|
+
|
|
59
|
+
支持点击切换已完成的步骤
|
|
60
|
+
|
|
61
|
+
**命中的子组件 API**: 属性: title
|
|
62
|
+
|
|
63
|
+
```vue
|
|
64
|
+
<script setup lang="ts">
|
|
65
|
+
import { ref } from 'vue';
|
|
66
|
+
import { Steps, Step } from '@king-design/vue';
|
|
67
|
+
|
|
68
|
+
const current = ref(0);
|
|
69
|
+
</script>
|
|
70
|
+
<template>
|
|
71
|
+
<Steps v-model="current" clickable>
|
|
72
|
+
<Step title="填写信息" />
|
|
73
|
+
<Step title="确认信息" />
|
|
74
|
+
<Step title="完成" />
|
|
75
|
+
</Steps>
|
|
76
|
+
</template>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
##### 垂直步骤条
|
|
80
|
+
**场景**: 创建垂直排列的步骤条
|
|
81
|
+
|
|
82
|
+
垂直排列的步骤条
|
|
83
|
+
|
|
84
|
+
**命中的子组件 API**: 属性: title
|
|
85
|
+
|
|
86
|
+
```vue
|
|
87
|
+
<script setup lang="ts">
|
|
88
|
+
import { ref } from 'vue';
|
|
89
|
+
import { Steps, Step } from '@king-design/vue';
|
|
90
|
+
|
|
91
|
+
const current = ref(1);
|
|
92
|
+
</script>
|
|
93
|
+
<template>
|
|
94
|
+
<Steps :value="current" vertical>
|
|
95
|
+
<Step title="步骤1" />
|
|
96
|
+
<Step title="步骤2" />
|
|
97
|
+
<Step title="步骤3" />
|
|
98
|
+
</Steps>
|
|
99
|
+
</template>
|
|
100
|
+
```
|
|
101
|
+
|
|
31
102
|
## 常见错误与正确用法 (Anti-Hallucination)
|
|
103
|
+
### value 从 1 开始而非 0
|
|
32
104
|
> **错误用法**: `const current = ref(1); // 期望第一步
|
|
33
105
|
<Steps :value="current">`
|
|
34
106
|
> **正确写法**: `const current = ref(0); // 第一步
|
|
35
107
|
<Steps :value="current">`
|
|
36
108
|
> **说明**: Steps 的 value 从 0 开始,0 表示第一步
|
|
37
109
|
|
|
110
|
+
### 使用 clickable 但未用 v-model
|
|
38
111
|
> **错误用法**: `<Steps :value="current" clickable> <!-- 点击不会改变值 -->`
|
|
39
112
|
> **正确写法**: `<Steps v-model="current" clickable>`
|
|
40
113
|
> **说明**: 使用 clickable 时需要用 v-model 进行双向绑定才能响应点击
|
|
41
114
|
|
|
115
|
+
### type 值拼写错误
|
|
42
116
|
> **错误用法**: `<Steps type="compact">`
|
|
43
117
|
> **正确写法**: `<Steps type="line-compact">`
|
|
44
118
|
> **说明**: type 只支持 default, line, simple, line-compact
|
|
@@ -12,34 +12,49 @@ import { Switch } from '@king-design/vue';
|
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
## 属性 (Props)
|
|
15
|
-
| 属性名 | 类型 | 默认值 | 必填 | 说明 | 示例 |
|
|
16
|
-
| --- | --- | --- | --- | --- | --- |
|
|
17
|
-
| value | `any` | `false` | 否 | 开关当前值,可用 v-model 双向绑定 | `<Switch v-model="value" />` |
|
|
18
|
-
| trueValue | `any` | `true` | 否 | 开启时的值 | `<Switch trueValue="on" falseValue="off" />` |
|
|
19
|
-
| falseValue | `any` | `false` | 否 | 关闭时的值 | `<Switch trueValue="1" falseValue="0" />` |
|
|
20
|
-
| on | `string` | `undefined` | 否 | 开启时显示的文案 | `<Switch on="开" off="关" />` |
|
|
21
|
-
| off | `string` | `undefined` | 否 | 关闭时显示的文案 | `<Switch on="ON" off="OFF" />` |
|
|
22
|
-
| disabled | `boolean` | `false` | 否 | 是否禁用 | `<Switch disabled />` |
|
|
23
|
-
| loading | `boolean` | `false` | 否 | 是否显示加载状态 | `<Switch :loading="isLoading" />` |
|
|
24
|
-
| size | `"large" | "default" | "small" | "mini"` | `"default"` | 否 | 尺寸 | `<Switch size="small" />` |
|
|
25
|
-
| width | `number | string` | `undefined` | 否 | 开关的宽度 | `<Switch :width="60" />` |
|
|
26
|
-
| height | `number | string` | `undefined` | 否 | 开关的高度 | `<Switch :height="24" />` |
|
|
27
|
-
| name | `string` | `undefined` | 否 | 开关的名称,用于表单提交 | `<Switch name="enable" />` |
|
|
28
|
-
| beforeChange | `(from: any, to: any) => boolean | Promise<boolean>` | `undefined` | 否 | 切换前的拦截函数,返回 false 阻止切换,支持异步 | `<Switch :beforeChange="handleBeforeChange" />` |
|
|
15
|
+
| 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
|
|
16
|
+
| --- | --- | --- | --- | --- | --- | --- |
|
|
17
|
+
| value | `any` | `false` | 否 | 开关当前值,可用 v-model 双向绑定 | - | `<Switch v-model="value" />` |
|
|
18
|
+
| trueValue | `any` | `true` | 否 | 开启时的值 | - | `<Switch trueValue="on" falseValue="off" />` |
|
|
19
|
+
| falseValue | `any` | `false` | 否 | 关闭时的值 | - | `<Switch trueValue="1" falseValue="0" />` |
|
|
20
|
+
| on | `string` | `undefined` | 否 | 开启时显示的文案 | - | `<Switch on="开" off="关" />` |
|
|
21
|
+
| off | `string` | `undefined` | 否 | 关闭时显示的文案 | - | `<Switch on="ON" off="OFF" />` |
|
|
22
|
+
| disabled | `boolean` | `false` | 否 | 是否禁用 | - | `<Switch disabled />` |
|
|
23
|
+
| loading | `boolean` | `false` | 否 | 是否显示加载状态 | - | `<Switch :loading="isLoading" />` |
|
|
24
|
+
| size | `"large" | "default" | "small" | "mini"` | `"default"` | 否 | 尺寸 | - | `<Switch size="small" />` |
|
|
25
|
+
| width | `number | string` | `undefined` | 否 | 开关的宽度 | - | `<Switch :width="60" />` |
|
|
26
|
+
| height | `number | string` | `undefined` | 否 | 开关的高度 | - | `<Switch :height="24" />` |
|
|
27
|
+
| name | `string` | `undefined` | 否 | 开关的名称,用于表单提交 | - | `<Switch name="enable" />` |
|
|
28
|
+
| beforeChange | `(from: any, to: any) => boolean | Promise<boolean>` | `undefined` | 否 | 切换前的拦截函数,返回 false 阻止切换,支持异步 | - | `<Switch :beforeChange="handleBeforeChange" />` |
|
|
29
29
|
|
|
30
30
|
## 插槽 (Slots)
|
|
31
31
|
| 插槽名 | 说明 | 模板写法 | 示例 |
|
|
32
32
|
| --- | --- | --- | --- |
|
|
33
|
-
| on | 扩展开启时的文案 | `
|
|
34
|
-
|
|
33
|
+
| on | 扩展开启时的文案 | `#on` | `<Switch>
|
|
34
|
+
<template #on>自定义on内容</template>
|
|
35
|
+
</Switch>` |
|
|
36
|
+
| off | 扩展关闭时的文案 | `#off` | `<Switch>
|
|
37
|
+
<template #off>自定义off内容</template>
|
|
38
|
+
</Switch>` |
|
|
39
|
+
|
|
40
|
+
### 插槽参数说明
|
|
41
|
+
**on**
|
|
42
|
+
|
|
43
|
+
- 参数结构: 无参数
|
|
44
|
+
|
|
45
|
+
**off**
|
|
46
|
+
|
|
47
|
+
- 参数结构: 无参数
|
|
35
48
|
|
|
36
49
|
## 常见错误与正确用法 (Anti-Hallucination)
|
|
50
|
+
### 在 Vue 中使用保留字 Switch
|
|
37
51
|
> **错误用法**: `import { Switch } from '@king-design/vue';
|
|
38
52
|
// 可能在某些情况下与 Vue 保留字冲突`
|
|
39
53
|
> **正确写法**: `import { Switch as KSwitch } from '@king-design/vue';
|
|
40
54
|
// 或直接使用 Switch,现代 Vue 3 通常没问题`
|
|
41
55
|
> **说明**: 在某些 Vue 版本中,Switch 可能是保留字,可以重命名为 KSwitch
|
|
42
56
|
|
|
57
|
+
### beforeChange 函数未正确返回布尔值
|
|
43
58
|
> **错误用法**: `const beforeChange = async () => {
|
|
44
59
|
await Dialog.confirm({});
|
|
45
60
|
// 忘记返回 true
|
|
@@ -54,6 +69,7 @@ import { Switch } from '@king-design/vue';
|
|
|
54
69
|
}`
|
|
55
70
|
> **说明**: beforeChange 必须返回布尔值,true 允许切换,false 阻止切换
|
|
56
71
|
|
|
72
|
+
### 自定义值类型与初始值不匹配
|
|
57
73
|
> **错误用法**: `const value = ref(false);
|
|
58
74
|
<Switch v-model="value" trueValue="yes" falseValue="no" />`
|
|
59
75
|
> **正确写法**: `const value = ref('no');
|