king-design-analyzer 2.1.7 → 2.2.0
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 +101 -0
- package/components/advancedset.json +127 -0
- package/components/affix.json +7 -0
- package/components/aksk.json +172 -0
- package/components/az.json +15 -2
- package/components/badge.json +7 -0
- package/components/billtypes.json +14 -2
- package/components/breadcrumb.json +7 -0
- package/components/button.json +191 -0
- package/components/buttonlink.json +73 -0
- package/components/card.json +8 -1
- package/components/cardcol.json +142 -0
- package/components/cardcols.json +121 -0
- package/components/cardcontent.json +15 -3
- package/components/cardtabs.json +172 -0
- package/components/carousel.json +7 -0
- package/components/cascader.json +520 -368
- package/components/checkbox.json +51 -4
- package/components/cidrinput.json +140 -0
- package/components/code.json +8 -1
- package/components/collapse.json +7 -0
- package/components/colorpicker.json +217 -0
- package/components/copy.json +7 -0
- package/components/copyhover.json +111 -0
- package/components/copyrow.json +124 -0
- package/components/datepicker.json +656 -524
- package/components/description.json +98 -0
- package/components/dialog.json +522 -455
- package/components/divider.json +8 -1
- package/components/drawer.json +571 -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 +151 -0
- package/components/form.json +131 -0
- 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 +161 -0
- package/components/icon.json +13 -1
- package/components/icontooltip.json +19 -1
- package/components/input.json +188 -4
- 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 +15 -3
- package/components/layoutlistcontent.json +148 -0
- package/components/layoutpermissioncontent.json +155 -0
- package/components/layoutstandardlist.json +275 -0
- package/components/layouttabs.json +168 -0
- package/components/lazymount.json +86 -0
- package/components/lazyteleport.json +118 -0
- package/components/menu.json +7 -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 +97 -8
- package/components/queuevisualrange.json +110 -0
- package/components/radio.json +82 -2
- package/components/rate.json +199 -0
- package/components/region.json +14 -2
- 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 +686 -666
- package/components/sidebar.json +198 -0
- package/components/skeleton.json +233 -0
- package/components/spin.json +8 -1
- package/components/split.json +260 -0
- package/components/sshkeys.json +138 -0
- package/components/status.json +60 -3
- package/components/steps.json +7 -0
- package/components/switch.json +8 -1
- package/components/table.json +18 -1
- package/components/tablecolumnid.json +14 -2
- package/components/tabs.json +12 -0
- package/components/timeline.json +213 -0
- package/components/timepicker.json +147 -3
- package/components/timerange.json +262 -0
- package/components/tip.json +7 -0
- package/components/tooltip.json +484 -395
- package/components/tour.json +418 -372
- package/components/transfer.json +27 -3
- package/components/tree.json +6 -4
- package/components/treeselect.json +556 -475
- package/components/upload.json +474 -473
- package/components/vdialog.json +308 -0
- package/components/vdrawer.json +331 -0
- package/components/virtuallist.json +7 -0
- package/dist/ast/index.d.mts +35 -1
- package/dist/ast/index.d.ts +35 -1
- package/dist/ast/index.js +5 -3
- package/dist/ast/index.mjs +3 -1
- package/dist/{chunk-DSWKLUIX.mjs → chunk-3LYQ5XFM.mjs} +1 -1
- package/dist/chunk-BI5TIQID.mjs +330 -0
- package/dist/{chunk-6QS5IGS6.js → chunk-CJGGFVQJ.js} +8 -8
- package/dist/chunk-CR3GC4H3.js +353 -0
- package/dist/{chunk-NZ6TLWMD.mjs → chunk-D2SXGGTX.mjs} +28 -17
- package/dist/{chunk-D3Y6FGWA.js → chunk-EYKZY2F3.js} +29 -18
- package/dist/chunk-JSBRDJBE.js +30 -0
- package/dist/chunk-KF5YBEM5.js +143 -0
- package/dist/chunk-KMIDURUR.mjs +33324 -0
- package/dist/chunk-QC6VTSA3.mjs +117 -0
- package/dist/chunk-SZYVGYKK.js +33350 -0
- package/dist/{chunk-WYSRJVX4.js → chunk-TA3SV4SP.js} +2 -2
- package/dist/chunk-UJCSKKID.mjs +27 -0
- package/dist/{chunk-FVSQ6BU6.mjs → chunk-XGPHQHLR.mjs} +4 -4
- package/dist/docs/index.js +1 -1
- package/dist/docs/index.mjs +1 -1
- package/dist/full/index.js +8 -6
- package/dist/full/index.mjs +6 -4
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +15 -13
- package/dist/index.mjs +7 -5
- package/dist/metadata/index.d.mts +22 -2
- package/dist/metadata/index.d.ts +22 -2
- package/dist/metadata/index.js +27 -17
- package/dist/metadata/index.mjs +27 -16
- package/dist/resolve-BsLBxlBi.d.mts +24 -0
- package/dist/resolve-BsLBxlBi.d.ts +24 -0
- package/dist/runtime/index.js +5 -4
- package/dist/runtime/index.mjs +3 -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 +6 -5
- package/dist/static/index.mjs +3 -2
- package/docs_for_llm/actions.doc.md +77 -0
- package/docs_for_llm/advancedset.doc.md +89 -0
- package/docs_for_llm/affix.doc.md +15 -7
- package/docs_for_llm/aksk.doc.md +111 -0
- package/docs_for_llm/az.doc.md +17 -11
- package/docs_for_llm/badge.doc.md +6 -5
- package/docs_for_llm/billtypes.doc.md +17 -11
- package/docs_for_llm/breadcrumb.doc.md +6 -3
- package/docs_for_llm/button.doc.md +34 -18
- package/docs_for_llm/buttonlink.doc.md +55 -0
- package/docs_for_llm/card.doc.md +8 -5
- 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 +10 -10
- package/docs_for_llm/cardtabs.doc.md +106 -0
- package/docs_for_llm/carousel.doc.md +8 -7
- package/docs_for_llm/cascader.doc.md +46 -25
- 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 +9 -6
- package/docs_for_llm/colorpicker.doc.md +104 -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 +71 -0
- package/docs_for_llm/datepicker.doc.md +51 -39
- package/docs_for_llm/description.doc.md +75 -0
- package/docs_for_llm/descriptions.doc.md +9 -6
- package/docs_for_llm/dialog.doc.md +48 -77
- package/docs_for_llm/divider.doc.md +9 -7
- package/docs_for_llm/drawer.doc.md +43 -84
- package/docs_for_llm/dropdown.doc.md +52 -21
- 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 +74 -0
- package/docs_for_llm/form.doc.md +33 -14
- 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 +7 -5
- package/docs_for_llm/header.doc.md +85 -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 +90 -39
- 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 +17 -17
- package/docs_for_llm/layoutlistcontent.doc.md +95 -0
- package/docs_for_llm/layoutpermissioncontent.doc.md +84 -0
- package/docs_for_llm/layoutstandardlist.doc.md +120 -0
- package/docs_for_llm/layouttabs.doc.md +101 -0
- package/docs_for_llm/lazymount.doc.md +73 -0
- package/docs_for_llm/lazyteleport.doc.md +76 -0
- package/docs_for_llm/menu.doc.md +14 -11
- package/docs_for_llm/message.doc.md +48 -10
- 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 +89 -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 +122 -0
- package/docs_for_llm/region.doc.md +25 -13
- 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 +40 -55
- package/docs_for_llm/sidebar.doc.md +133 -0
- package/docs_for_llm/skeleton.doc.md +117 -0
- package/docs_for_llm/slider.doc.md +31 -21
- package/docs_for_llm/spin.doc.md +8 -5
- package/docs_for_llm/spinner.doc.md +28 -18
- package/docs_for_llm/split.doc.md +157 -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 +10 -7
- package/docs_for_llm/switch.doc.md +17 -14
- package/docs_for_llm/table.doc.md +118 -51
- package/docs_for_llm/tablecolumnid.doc.md +36 -16
- package/docs_for_llm/tabs.doc.md +19 -10
- package/docs_for_llm/tag.doc.md +19 -10
- package/docs_for_llm/timeline.doc.md +109 -0
- package/docs_for_llm/timepicker.doc.md +57 -38
- package/docs_for_llm/timerange.doc.md +157 -0
- package/docs_for_llm/tip.doc.md +20 -11
- package/docs_for_llm/tooltip.doc.md +55 -29
- package/docs_for_llm/tour.doc.md +48 -29
- package/docs_for_llm/transfer.doc.md +40 -29
- package/docs_for_llm/tree.doc.md +65 -23
- package/docs_for_llm/treeselect.doc.md +37 -48
- package/docs_for_llm/upload.doc.md +56 -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 +129 -0
- package/docs_for_llm/vdrawer.doc.md +119 -0
- package/docs_for_llm/virtuallist.doc.md +6 -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 +12 -6
- package/dist/chunk-HDV7ETXE.mjs +0 -1055
- package/dist/chunk-HPAUCD5I.js +0 -156
- package/dist/chunk-L4DS3EXI.mjs +0 -133
- package/dist/chunk-YWY3D4J7.js +0 -1082
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# 骨架屏 (Skeleton)
|
|
2
|
+
|
|
3
|
+
骨架屏组件,用于在内容加载阶段展示占位结构,减轻页面空白感。支持内置文本行、头像骨架和自定义骨架项。
|
|
4
|
+
|
|
5
|
+
**关键词**: skeleton, 骨架屏, loading, 占位, avator, SkeletonItem
|
|
6
|
+
|
|
7
|
+
**使用场景**: 列表加载占位、详情页内容预加载、卡片骨架、表单异步初始化
|
|
8
|
+
|
|
9
|
+
## 导入语句
|
|
10
|
+
```typescript
|
|
11
|
+
import { Skeleton, SkeletonItem } from '@king-design/vue';
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## 属性 (Props)
|
|
15
|
+
| 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
|
|
16
|
+
| --- | --- | --- | --- | --- | --- | --- |
|
|
17
|
+
| loading | `boolean` | `undefined` | 是 | 是否处于加载中。为 true 时显示骨架内容,否则渲染为空或交由外层控制真实内容展示。 | - | `<Skeleton :loading="loading" />` |
|
|
18
|
+
| animated | `boolean` | `false` | 否 | 是否启用骨架闪动动画。 | - | `<Skeleton :loading="loading" animated />` |
|
|
19
|
+
| rows | `number` | `2` | 否 | 文本骨架行数,最小按 1 处理。 | - | `<Skeleton :loading="loading" :rows="4" />` |
|
|
20
|
+
| avator | `boolean` | `false` | 否 | 是否展示头像占位。注意组件属性名为 avator,与常见 avatar 拼写不同。 | - | `<Skeleton :loading="loading" avator />` |
|
|
21
|
+
| size | `string` | `"large"` | 否 | 骨架尺寸,影响占位块的高度与间距。 | - | `<Skeleton :loading="loading" size="small" />` |
|
|
22
|
+
|
|
23
|
+
## 插槽 (Slots)
|
|
24
|
+
| 插槽名 | 说明 | 模板写法 | 示例 |
|
|
25
|
+
| --- | --- | --- | --- |
|
|
26
|
+
| default | 自定义骨架内容。当 loading 为 true 时,默认插槽内容会作为骨架结构渲染。 | `<Skeleton :loading="loading">...</Skeleton>` | `<Skeleton :loading="loading"><div style="display:flex; gap:12px;"><SkeletonItem type="avator" /><div style="flex:1;"><SkeletonItem type="text" /><SkeletonItem type="text" /></div></div></Skeleton>` |
|
|
27
|
+
|
|
28
|
+
## 子组件 (Sub-Components)
|
|
29
|
+
### SkeletonItem
|
|
30
|
+
单个骨架项组件,用于组合更复杂的骨架布局。
|
|
31
|
+
|
|
32
|
+
| 属性名 | 类型 | 说明 | 示例 |
|
|
33
|
+
| --- | --- | --- | --- |
|
|
34
|
+
| type | `"text" | "avator" | "image" | "button" | "input"` | 骨架项类型。 | `<SkeletonItem type="image" />` |
|
|
35
|
+
|
|
36
|
+
## 常见错误与正确用法 (Anti-Hallucination)
|
|
37
|
+
### 误以为 Skeleton 会自动在 loading=false 时渲染真实内容
|
|
38
|
+
> **错误用法**: `<Skeleton :loading="loading"><RealContent /></Skeleton>`
|
|
39
|
+
> **正确写法**: `<Skeleton :loading="loading"><SkeletonItem type="text" /></Skeleton>
|
|
40
|
+
<RealContent v-if="!loading" />`
|
|
41
|
+
> **说明**: 当前 Skeleton 在 loading 为 true 时负责渲染骨架结构,真实内容建议由外层通过条件渲染控制。
|
|
42
|
+
|
|
43
|
+
### 把 avator 错写成 avatar
|
|
44
|
+
> **错误用法**: `<Skeleton :loading="loading" avatar />`
|
|
45
|
+
> **正确写法**: `<Skeleton :loading="loading" avator />`
|
|
46
|
+
> **说明**: 该组件实际属性名是 avator,需按源码字段使用,否则不会展示头像骨架。
|
|
47
|
+
|
|
48
|
+
## 使用示例
|
|
49
|
+
### 基础用法
|
|
50
|
+
**场景**: 列表请求中展示文本占位
|
|
51
|
+
|
|
52
|
+
展示默认文本骨架。
|
|
53
|
+
|
|
54
|
+
**使用的 API**: 属性: loading, rows, animated
|
|
55
|
+
|
|
56
|
+
```vue
|
|
57
|
+
<script setup lang="ts">
|
|
58
|
+
import { ref } from 'vue';
|
|
59
|
+
import { Skeleton } from '@king-design/vue';
|
|
60
|
+
|
|
61
|
+
const loading = ref(true);
|
|
62
|
+
</script>
|
|
63
|
+
<template>
|
|
64
|
+
<Skeleton :loading="loading" :rows="3" animated />
|
|
65
|
+
</template>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 带头像骨架
|
|
69
|
+
**场景**: 个人信息卡片加载态
|
|
70
|
+
|
|
71
|
+
适合用户卡片、评论列表等结构。
|
|
72
|
+
|
|
73
|
+
**使用的 API**: 属性: loading, avator, rows
|
|
74
|
+
|
|
75
|
+
```vue
|
|
76
|
+
<script setup lang="ts">
|
|
77
|
+
import { ref } from 'vue';
|
|
78
|
+
import { Skeleton } from '@king-design/vue';
|
|
79
|
+
|
|
80
|
+
const loading = ref(true);
|
|
81
|
+
</script>
|
|
82
|
+
<template>
|
|
83
|
+
<Skeleton :loading="loading" avator :rows="2" />
|
|
84
|
+
</template>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 自定义骨架布局
|
|
88
|
+
**场景**: 自定义复杂卡片骨架
|
|
89
|
+
|
|
90
|
+
通过 SkeletonItem 自定义表单或卡片骨架。
|
|
91
|
+
|
|
92
|
+
**使用的 API**: 属性: loading | 插槽: default
|
|
93
|
+
|
|
94
|
+
```vue
|
|
95
|
+
<script setup lang="ts">
|
|
96
|
+
import { ref } from 'vue';
|
|
97
|
+
import { Skeleton, SkeletonItem } from '@king-design/vue';
|
|
98
|
+
|
|
99
|
+
const loading = ref(true);
|
|
100
|
+
</script>
|
|
101
|
+
<template>
|
|
102
|
+
<Skeleton :loading="loading">
|
|
103
|
+
<div style="display: flex; gap: 12px; align-items: flex-start;">
|
|
104
|
+
<SkeletonItem type="image" />
|
|
105
|
+
<div style="flex: 1; display: grid; gap: 8px;">
|
|
106
|
+
<SkeletonItem type="text" />
|
|
107
|
+
<SkeletonItem type="input" />
|
|
108
|
+
<SkeletonItem type="button" />
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
</Skeleton>
|
|
112
|
+
</template>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## 相关组件
|
|
116
|
+
Spin, Card, Image
|
|
117
|
+
|
|
@@ -12,33 +12,40 @@ import { Slider } from '@king-design/vue';
|
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
## 属性 (Props)
|
|
15
|
-
| 属性名 | 类型 | 默认值 | 必填 | 说明 | 示例 |
|
|
16
|
-
| --- | --- | --- | --- | --- | --- |
|
|
17
|
-
| value | `number | [number, number]` | `0` | 否 | 当前值,可用 v-model 双向绑定。范围选择时为 [number, number] 数组 | `<Slider v-model="value" />` |
|
|
18
|
-
| min | `number` | `0` | 否 | 最小值 | `<Slider :min="0" />` |
|
|
19
|
-
| max | `number` | `100` | 否 | 最大值 | `<Slider :max="200" />` |
|
|
20
|
-
| range | `boolean` | `false` | 否 | 是否是范围选择(双滑块) | `<Slider v-model="rangeValue" range />` |
|
|
21
|
-
| step | `number | StepObject | StepFunction` | `1` | 否 | 步长,支持数字、对象配置或函数 | `<Slider :step="10" />` |
|
|
22
|
-
| disabled | `boolean` | `false` | 否 | 是否禁用 | `<Slider disabled />` |
|
|
23
|
-
| unit | `string` | `""` | 否 | 单位,用于刻度展示 | `<Slider unit="%" />` |
|
|
24
|
-
| showEnd | `boolean` | `true` | 否 | 是否展示最小值和最大值刻度 | `<Slider :showEnd="false" />` |
|
|
25
|
-
| showInput | `boolean` | `true` | 否 | 是否展示输入框 | `<Slider :showInput="false" />` |
|
|
26
|
-
| showTooltip | `boolean` | `false` | 否 | 是否展示提示气泡 | `<Slider showTooltip />` |
|
|
27
|
-
| always | `boolean` | `false` | 否 | 当展示气泡时,是否一直展示 | `<Slider showTooltip always />` |
|
|
28
|
-
| points | `boolean | number[]` | `false` | 否 | 是否展示间隔点,或指定哪些值展示间隔点 | `<Slider :points="[25, 50, 75]" />` |
|
|
29
|
-
| marks | `Marks` | `undefined` | 否 | 标注刻度,对象形式指定位置和标签 | `<Slider :marks="{0: '低', 50: '中', 100: '高'}" />` |
|
|
30
|
-
| animate | `boolean` | `true` | 否 | 滑块移动是否使用缓动动画 | `<Slider :animate="false" />` |
|
|
31
|
-
| forceStep | `boolean` | `true` | 否 | 是否限制 value(除边界外)满足 min + step * n | `<Slider :forceStep="false" />` |
|
|
32
|
-
| tooltipProps | `TooltipProps` | `undefined` | 否 | 设置内置 Tooltip 的所有属性 | `<Slider showTooltip :tooltipProps="{position: 'bottom'}" />` |
|
|
33
|
-
| spinnerProps | `SpinnerProps` | `undefined` | 否 | 设置内置 Spinner 输入框的所有属性 | `<Slider :spinnerProps="{precision: 2}" />` |
|
|
15
|
+
| 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
|
|
16
|
+
| --- | --- | --- | --- | --- | --- | --- |
|
|
17
|
+
| value | `number | [number, number]` | `0` | 否 | 当前值,可用 v-model 双向绑定。范围选择时为 [number, number] 数组 | - | `<Slider v-model="value" />` |
|
|
18
|
+
| min | `number` | `0` | 否 | 最小值 | - | `<Slider :min="0" />` |
|
|
19
|
+
| max | `number` | `100` | 否 | 最大值 | - | `<Slider :max="200" />` |
|
|
20
|
+
| range | `boolean` | `false` | 否 | 是否是范围选择(双滑块) | - | `<Slider v-model="rangeValue" range />` |
|
|
21
|
+
| step | `number | StepObject | StepFunction` | `1` | 否 | 步长,支持数字、对象配置或函数 | - | `<Slider :step="10" />` |
|
|
22
|
+
| disabled | `boolean` | `false` | 否 | 是否禁用 | - | `<Slider disabled />` |
|
|
23
|
+
| unit | `string` | `""` | 否 | 单位,用于刻度展示 | - | `<Slider unit="%" />` |
|
|
24
|
+
| showEnd | `boolean` | `true` | 否 | 是否展示最小值和最大值刻度 | - | `<Slider :showEnd="false" />` |
|
|
25
|
+
| showInput | `boolean` | `true` | 否 | 是否展示输入框 | - | `<Slider :showInput="false" />` |
|
|
26
|
+
| showTooltip | `boolean` | `false` | 否 | 是否展示提示气泡 | - | `<Slider showTooltip />` |
|
|
27
|
+
| always | `boolean` | `false` | 否 | 当展示气泡时,是否一直展示 | - | `<Slider showTooltip always />` |
|
|
28
|
+
| points | `boolean | number[]` | `false` | 否 | 是否展示间隔点,或指定哪些值展示间隔点 | - | `<Slider :points="[25, 50, 75]" />` |
|
|
29
|
+
| marks | `Marks` | `undefined` | 否 | 标注刻度,对象形式指定位置和标签 | - | `<Slider :marks="{0: '低', 50: '中', 100: '高'}" />` |
|
|
30
|
+
| animate | `boolean` | `true` | 否 | 滑块移动是否使用缓动动画 | - | `<Slider :animate="false" />` |
|
|
31
|
+
| forceStep | `boolean` | `true` | 否 | 是否限制 value(除边界外)满足 min + step * n | - | `<Slider :forceStep="false" />` |
|
|
32
|
+
| tooltipProps | `TooltipProps` | `undefined` | 否 | 设置内置 Tooltip 的所有属性 | - | `<Slider showTooltip :tooltipProps="{position: 'bottom'}" />` |
|
|
33
|
+
| spinnerProps | `SpinnerProps` | `undefined` | 否 | 设置内置 Spinner 输入框的所有属性 | - | `<Slider :spinnerProps="{precision: 2}" />` |
|
|
34
34
|
|
|
35
35
|
## 事件 (Events)
|
|
36
36
|
| 事件名 | Vue事件名 | 说明 | 回调参数 | 示例 |
|
|
37
37
|
| --- | --- | --- | --- | --- |
|
|
38
38
|
| change | `@change` | 当值变化时触发,拖动过程中不会触发,拖动结束时触发 | `newValue: number | [number, number], oldValue: number | [number, number]` | `<Slider @change="handleChange" />` |
|
|
39
39
|
|
|
40
|
-
###
|
|
41
|
-
**change
|
|
40
|
+
### 事件参数说明
|
|
41
|
+
**change**
|
|
42
|
+
|
|
43
|
+
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
|
44
|
+
| --- | --- | --- | --- | --- |
|
|
45
|
+
| newValue | `number | [number, number]` | 是 | - | 新的值 |
|
|
46
|
+
| oldValue | `number | [number, number]` | 是 | - | 旧的值 |
|
|
47
|
+
|
|
48
|
+
事件处理示例:
|
|
42
49
|
```typescript
|
|
43
50
|
const handleChange = (newVal: number, oldVal: number) => {
|
|
44
51
|
console.log(`值从 ${oldVal} 变为 ${newVal}`);
|
|
@@ -51,16 +58,19 @@ const handleChange = (newVal: number, oldVal: number) => {
|
|
|
51
58
|
| tooltip | 当展示提示气泡,定义气泡的内容,和Tooltip组件行为一样,如果你传入空的内容,则不会展示气泡 | `undefined` | - |
|
|
52
59
|
|
|
53
60
|
## 常见错误与正确用法 (Anti-Hallucination)
|
|
61
|
+
### 范围选择时 value 类型错误
|
|
54
62
|
> **错误用法**: `const value = ref(50);
|
|
55
63
|
<Slider v-model="value" range />`
|
|
56
64
|
> **正确写法**: `const value = ref<[number, number]>([20, 80]);
|
|
57
65
|
<Slider v-model="value" range />`
|
|
58
66
|
> **说明**: 当 range 为 true 时,value 必须是 [number, number] 数组
|
|
59
67
|
|
|
68
|
+
### step 使用字符串而非数字
|
|
60
69
|
> **错误用法**: `<Slider step="10" />`
|
|
61
70
|
> **正确写法**: `<Slider :step="10" />`
|
|
62
71
|
> **说明**: step 是数字类型,需要使用 v-bind 语法
|
|
63
72
|
|
|
73
|
+
### marks 格式错误
|
|
64
74
|
> **错误用法**: `const marks = ['低', '中', '高'];`
|
|
65
75
|
> **正确写法**: `const marks = {
|
|
66
76
|
0: '低',
|
package/docs_for_llm/spin.doc.md
CHANGED
|
@@ -12,11 +12,11 @@ import { Spin } from '@king-design/vue';
|
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
## 属性 (Props)
|
|
15
|
-
| 属性名 | 类型 | 默认值 | 必填 | 说明 | 示例 |
|
|
16
|
-
| --- | --- | --- | --- | --- | --- |
|
|
17
|
-
| size | `"large" | "default" | "small" | "mini"` | `"default"` | 否 | 组件尺寸 | `<Spin size="small" />` |
|
|
18
|
-
| center | `boolean` | `false` | 否 | 是否居中展示,需要父元素为定位元素(position: relative/absolute) | `<Spin center />` |
|
|
19
|
-
| overlay | `boolean` | `false` | 否 | 是否展示带遮罩层的加载动画,需要父元素为定位元素 | `<Spin overlay center />` |
|
|
15
|
+
| 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
|
|
16
|
+
| --- | --- | --- | --- | --- | --- | --- |
|
|
17
|
+
| size | `"large" | "default" | "small" | "mini"` | `"default"` | 否 | 组件尺寸 | - | `<Spin size="small" />` |
|
|
18
|
+
| center | `boolean` | `false` | 否 | 是否居中展示,需要父元素为定位元素(position: relative/absolute) | - | `<Spin center />` |
|
|
19
|
+
| overlay | `boolean` | `false` | 否 | 是否展示带遮罩层的加载动画,需要父元素为定位元素 | - | `<Spin overlay center />` |
|
|
20
20
|
|
|
21
21
|
## 插槽 (Slots)
|
|
22
22
|
| 插槽名 | 说明 | 模板写法 | 示例 |
|
|
@@ -24,6 +24,7 @@ import { Spin } from '@king-design/vue';
|
|
|
24
24
|
| canvas | 自定义旋转的元素内容 | `undefined` | - |
|
|
25
25
|
|
|
26
26
|
## 常见错误与正确用法 (Anti-Hallucination)
|
|
27
|
+
### 使用 center 但父元素无定位
|
|
27
28
|
> **错误用法**: `<div>
|
|
28
29
|
<Spin center />
|
|
29
30
|
</div>`
|
|
@@ -32,6 +33,7 @@ import { Spin } from '@king-design/vue';
|
|
|
32
33
|
</div>`
|
|
33
34
|
> **说明**: 使用 center 属性时,父元素必须设置 position: relative 或 absolute
|
|
34
35
|
|
|
36
|
+
### 使用 overlay 但父元素无定位
|
|
35
37
|
> **错误用法**: `<div>
|
|
36
38
|
<Spin overlay />
|
|
37
39
|
<p>内容</p>
|
|
@@ -42,6 +44,7 @@ import { Spin } from '@king-design/vue';
|
|
|
42
44
|
</div>`
|
|
43
45
|
> **说明**: 使用 overlay 时,父元素必须设置定位,且通常配合 center 使用
|
|
44
46
|
|
|
47
|
+
### size 值拼写错误
|
|
45
48
|
> **错误用法**: `<Spin size="xs" />`
|
|
46
49
|
> **正确写法**: `<Spin size="mini" />`
|
|
47
50
|
> **说明**: size 只支持 large, default, small, mini,不存在 xs 值
|
|
@@ -12,30 +12,36 @@ import { Spinner } from '@king-design/vue';
|
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
## 属性 (Props)
|
|
15
|
-
| 属性名 | 类型 | 默认值 | 必填 | 说明 | 示例 |
|
|
16
|
-
| --- | --- | --- | --- | --- | --- |
|
|
17
|
-
| value | `number` | `0` | 否 | 组件的值,可用 v-model 进行双向绑定 | `<Spinner v-model="count" />` |
|
|
18
|
-
| disabled | `boolean` | `false` | 否 | 是否禁用 | `<Spinner disabled />` |
|
|
19
|
-
| max | `number` | `Number.POSITIVE_INFINITY` | 否 | 最大值 | `<Spinner :max="100" />` |
|
|
20
|
-
| min | `number` | `Number.NEGATIVE_INFINITY` | 否 | 最小值 | `<Spinner :min="0" />` |
|
|
21
|
-
| step | `number | StepObject | StepFunction` | `1` | 否 | 步长,支持数字、对象或函数形式的动态步长 | `<Spinner :step="5" />` |
|
|
22
|
-
| size | `"default" | "small" | "mini"` | `"default"` | 否 | 尺寸 | `<Spinner size="small" />` |
|
|
23
|
-
| vertical | `boolean` | `false` | 否 | 控制按钮是否竖直排列 | `<Spinner vertical />` |
|
|
24
|
-
| precision | `number` | `undefined` | 否 | 控制展示精度,该值必须为正整数或 0 | `<Spinner :precision="2" :step="0.1" />` |
|
|
25
|
-
| formatter | `(value: number) => string` | `undefined` | 否 | 定义格式化展示值的函数 | `<Spinner :formatter="(val) => `${val}%`" :parser="(val) => parseFloat(val)" /></Spinner>` |
|
|
26
|
-
| parser | `(value: string) => number` | `undefined` | 否 | 与 formatter 结合使用,定义解析格式化的值的函数 | `<Spinner :formatter="(val) => `${val}%`" :parser="(val) => parseFloat(val)" /></Spinner>` |
|
|
27
|
-
| prefix | `string` | `undefined` | 否 | 定义展示的值的前缀,优先级低于 formatter | `<Spinner prefix="¥" />` |
|
|
28
|
-
| suffix | `string` | `undefined` | 否 | 定义展示的值的后缀,优先级低于 formatter | `<Spinner suffix="元" />` |
|
|
29
|
-
| width | `string | number` | `undefined` | 否 | 指定 Input 输入框的宽度 | `<Spinner :width="150" />` |
|
|
30
|
-
| forceStep | `boolean` | `false` | 否 | value 值除了边界值,都必须满足 min + step * n(n 为整数) | `<Spinner :min="0" :step="5" forceStep />` |
|
|
15
|
+
| 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
|
|
16
|
+
| --- | --- | --- | --- | --- | --- | --- |
|
|
17
|
+
| value | `number` | `0` | 否 | 组件的值,可用 v-model 进行双向绑定 | - | `<Spinner v-model="count" />` |
|
|
18
|
+
| disabled | `boolean` | `false` | 否 | 是否禁用 | - | `<Spinner disabled />` |
|
|
19
|
+
| max | `number` | `Number.POSITIVE_INFINITY` | 否 | 最大值 | - | `<Spinner :max="100" />` |
|
|
20
|
+
| min | `number` | `Number.NEGATIVE_INFINITY` | 否 | 最小值 | - | `<Spinner :min="0" />` |
|
|
21
|
+
| step | `number | StepObject | StepFunction` | `1` | 否 | 步长,支持数字、对象或函数形式的动态步长 | - | `<Spinner :step="5" />` |
|
|
22
|
+
| size | `"default" | "small" | "mini"` | `"default"` | 否 | 尺寸 | - | `<Spinner size="small" />` |
|
|
23
|
+
| vertical | `boolean` | `false` | 否 | 控制按钮是否竖直排列 | - | `<Spinner vertical />` |
|
|
24
|
+
| precision | `number` | `undefined` | 否 | 控制展示精度,该值必须为正整数或 0 | - | `<Spinner :precision="2" :step="0.1" />` |
|
|
25
|
+
| formatter | `(value: number) => string` | `undefined` | 否 | 定义格式化展示值的函数 | - | `<Spinner :formatter="(val) => `${val}%`" :parser="(val) => parseFloat(val)" /></Spinner>` |
|
|
26
|
+
| parser | `(value: string) => number` | `undefined` | 否 | 与 formatter 结合使用,定义解析格式化的值的函数 | - | `<Spinner :formatter="(val) => `${val}%`" :parser="(val) => parseFloat(val)" /></Spinner>` |
|
|
27
|
+
| prefix | `string` | `undefined` | 否 | 定义展示的值的前缀,优先级低于 formatter | - | `<Spinner prefix="¥" />` |
|
|
28
|
+
| suffix | `string` | `undefined` | 否 | 定义展示的值的后缀,优先级低于 formatter | - | `<Spinner suffix="元" />` |
|
|
29
|
+
| width | `string | number` | `undefined` | 否 | 指定 Input 输入框的宽度 | - | `<Spinner :width="150" />` |
|
|
30
|
+
| forceStep | `boolean` | `false` | 否 | value 值除了边界值,都必须满足 min + step * n(n 为整数) | - | `<Spinner :min="0" :step="5" forceStep />` |
|
|
31
31
|
|
|
32
32
|
## 事件 (Events)
|
|
33
33
|
| 事件名 | Vue事件名 | 说明 | 回调参数 | 示例 |
|
|
34
34
|
| --- | --- | --- | --- | --- |
|
|
35
35
|
| change | `@change` | value 值变化时触发,仅在输入框 change 事件触发或点击加减按钮改变 value 时触发 | `value: number` | `<Spinner @change="handleChange" />` |
|
|
36
36
|
|
|
37
|
-
###
|
|
38
|
-
**change
|
|
37
|
+
### 事件参数说明
|
|
38
|
+
**change**
|
|
39
|
+
|
|
40
|
+
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
|
41
|
+
| --- | --- | --- | --- | --- |
|
|
42
|
+
| value | `number` | 是 | - | 当前的数值 |
|
|
43
|
+
|
|
44
|
+
事件处理示例:
|
|
39
45
|
```typescript
|
|
40
46
|
const handleChange = (value: number) => {
|
|
41
47
|
console.log('当前值:', value);
|
|
@@ -43,18 +49,22 @@ const handleChange = (value: number) => {
|
|
|
43
49
|
```
|
|
44
50
|
|
|
45
51
|
## 常见错误与正确用法 (Anti-Hallucination)
|
|
52
|
+
### precision 设置为负数
|
|
46
53
|
> **错误用法**: `<Spinner :precision="-1" />`
|
|
47
54
|
> **正确写法**: `<Spinner :precision="2" />`
|
|
48
55
|
> **说明**: precision 必须为正整数或 0,负数无效
|
|
49
56
|
|
|
57
|
+
### 使用不存在的 size 值 (Spinner)
|
|
50
58
|
> **错误用法**: `<Spinner size="large" />`
|
|
51
59
|
> **正确写法**: `<Spinner size="default" />`
|
|
52
60
|
> **说明**: Spinner 的 size 只支持 default, small, mini。Spinner 组件目前不支持 large 尺寸。
|
|
53
61
|
|
|
62
|
+
### 使用 formatter 但未提供 parser
|
|
54
63
|
> **错误用法**: `<Spinner :formatter="(val) => `${val}%`" />`
|
|
55
64
|
> **正确写法**: `<Spinner :formatter="(val) => `${val}%`" :parser="(val) => parseFloat(val)" />`
|
|
56
65
|
> **说明**: 使用 formatter 格式化显示时,必须同时提供 parser 来解析用户输入
|
|
57
66
|
|
|
67
|
+
### min 大于 max
|
|
58
68
|
> **错误用法**: `<Spinner :min="100" :max="0" />`
|
|
59
69
|
> **正确写法**: `<Spinner :min="0" :max="100" />`
|
|
60
70
|
> **说明**: min 值必须小于或等于 max 值
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# 分栏拖拽 (Split)
|
|
2
|
+
|
|
3
|
+
可拖拽调整尺寸的分栏布局组件。支持横向和纵向两种模式,通过 `first`、`last` 命名插槽定义两侧内容。
|
|
4
|
+
|
|
5
|
+
**关键词**: split, 分栏, 拖拽布局, 左右布局, 上下布局, resize
|
|
6
|
+
|
|
7
|
+
**使用场景**: 侧边栏加主内容区、编辑器与预览区、日志面板、控制台双栏布局
|
|
8
|
+
|
|
9
|
+
## 导入语句
|
|
10
|
+
```typescript
|
|
11
|
+
import { Split } from '@king-design/vue';
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## 属性 (Props)
|
|
15
|
+
| 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
|
|
16
|
+
| --- | --- | --- | --- | --- | --- | --- |
|
|
17
|
+
| mode | `"horizontal" | "vertical"` | `"horizontal"` | 否 | 分栏方向。 | - | `<Split mode="vertical">` |
|
|
18
|
+
| firstSize | `string` | `"auto"` | 否 | 第一个面板尺寸,支持具体尺寸值或 auto。 | - | `<Split firstSize="240px">` |
|
|
19
|
+
| lastSize | `string` | `"auto"` | 否 | 第二个面板尺寸,支持具体尺寸值或 auto。 | - | `<Split lastSize="320px">` |
|
|
20
|
+
| min | `number | string` | `0` | 否 | 拖拽时允许的最小尺寸。 | - | `<Split firstSize="240px" :min="120" />` |
|
|
21
|
+
| max | `number | string` | `"100%-6"` | 否 | 拖拽时允许的最大尺寸。 | - | `<Split firstSize="240px" max="60%" />` |
|
|
22
|
+
|
|
23
|
+
## 事件 (Events)
|
|
24
|
+
| 事件名 | Vue事件名 | 说明 | 回调参数 | 示例 |
|
|
25
|
+
| --- | --- | --- | --- | --- |
|
|
26
|
+
| moveStart | `@moveStart` | 开始拖拽时触发。 | `e: MouseEvent` | `<Split @moveStart="handleMoveStart">` |
|
|
27
|
+
| moving | `@moving` | 拖拽过程中持续触发。 | `e: MouseEvent` | `<Split @moving="handleMoving">` |
|
|
28
|
+
| moveEnd | `@moveEnd` | 拖拽结束时触发。 | `e: MouseEvent | undefined` | `<Split @moveEnd="handleMoveEnd">` |
|
|
29
|
+
|
|
30
|
+
### 事件参数说明
|
|
31
|
+
**moveStart**
|
|
32
|
+
|
|
33
|
+
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
|
34
|
+
| --- | --- | --- | --- | --- |
|
|
35
|
+
| e | `MouseEvent` | 是 | - | 原生鼠标事件 |
|
|
36
|
+
|
|
37
|
+
事件处理示例:
|
|
38
|
+
```typescript
|
|
39
|
+
const handleMoveStart = (e: MouseEvent) => {
|
|
40
|
+
console.log('开始拖拽');
|
|
41
|
+
};
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**moving**
|
|
45
|
+
|
|
46
|
+
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
|
47
|
+
| --- | --- | --- | --- | --- |
|
|
48
|
+
| e | `MouseEvent` | 是 | - | 原生鼠标事件 |
|
|
49
|
+
|
|
50
|
+
事件处理示例:
|
|
51
|
+
```typescript
|
|
52
|
+
const handleMoving = (e: MouseEvent) => {
|
|
53
|
+
console.log('拖拽中');
|
|
54
|
+
};
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**moveEnd**
|
|
58
|
+
|
|
59
|
+
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
|
60
|
+
| --- | --- | --- | --- | --- |
|
|
61
|
+
| e | `MouseEvent | undefined` | 是 | - | 原生鼠标事件 |
|
|
62
|
+
|
|
63
|
+
事件处理示例:
|
|
64
|
+
```typescript
|
|
65
|
+
const handleMoveEnd = (e?: MouseEvent) => {
|
|
66
|
+
console.log('拖拽结束');
|
|
67
|
+
};
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## 插槽 (Slots)
|
|
71
|
+
| 插槽名 | 说明 | 模板写法 | 示例 |
|
|
72
|
+
| --- | --- | --- | --- |
|
|
73
|
+
| first | 第一个面板内容。 | `<template #first>...</template>` | `<Split><template #first>左侧内容</template><template #last>右侧内容</template></Split>` |
|
|
74
|
+
| last | 第二个面板内容。 | `<template #last>...</template>` | `<Split><template #first>左侧内容</template><template #last>右侧内容</template></Split>` |
|
|
75
|
+
| drag | 自定义拖拽分割条内容。 | `<template #drag>...</template>` | `<Split><template #drag><div class="custom-handle" /></template></Split>` |
|
|
76
|
+
|
|
77
|
+
## 常见错误与正确用法 (Anti-Hallucination)
|
|
78
|
+
### 未使用 first 和 last 命名插槽
|
|
79
|
+
> **错误用法**: `<Split>
|
|
80
|
+
<div>左侧</div>
|
|
81
|
+
<div>右侧</div>
|
|
82
|
+
</Split>`
|
|
83
|
+
> **正确写法**: `<Split>
|
|
84
|
+
<template #first><div>左侧</div></template>
|
|
85
|
+
<template #last><div>右侧</div></template>
|
|
86
|
+
</Split>`
|
|
87
|
+
> **说明**: Split 使用命名插槽组织两个面板,直接写默认子节点不会正确分配到两侧区域。
|
|
88
|
+
|
|
89
|
+
### 同时固定 firstSize 和 lastSize,导致拖拽空间不足
|
|
90
|
+
> **错误用法**: `<Split firstSize="300px" lastSize="500px">...</Split>`
|
|
91
|
+
> **正确写法**: `<Split firstSize="300px" lastSize="auto">...</Split>`
|
|
92
|
+
> **说明**: 实际使用中通常固定一侧,另一侧使用 auto,让拖拽有可调整空间。
|
|
93
|
+
|
|
94
|
+
## 使用示例
|
|
95
|
+
### 左右分栏
|
|
96
|
+
**场景**: 后台页面侧边栏和主内容区
|
|
97
|
+
|
|
98
|
+
基础的横向可拖拽布局。
|
|
99
|
+
|
|
100
|
+
**使用的 API**: 属性: firstSize | 插槽: first, last
|
|
101
|
+
|
|
102
|
+
```vue
|
|
103
|
+
<template>
|
|
104
|
+
<Split firstSize="240px" style="height: 320px; border: 1px solid #eee;">
|
|
105
|
+
<template #first>
|
|
106
|
+
<div style="padding: 16px;">左侧目录</div>
|
|
107
|
+
</template>
|
|
108
|
+
<template #last>
|
|
109
|
+
<div style="padding: 16px;">右侧内容</div>
|
|
110
|
+
</template>
|
|
111
|
+
</Split>
|
|
112
|
+
</template>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 上下分栏
|
|
116
|
+
**场景**: 上下布局的编辑器和预览区
|
|
117
|
+
|
|
118
|
+
适合日志面板或上下编辑区。
|
|
119
|
+
|
|
120
|
+
**使用的 API**: 属性: mode, firstSize | 插槽: first, last
|
|
121
|
+
|
|
122
|
+
```vue
|
|
123
|
+
<template>
|
|
124
|
+
<Split mode="vertical" firstSize="120px" style="height: 360px; border: 1px solid #eee;">
|
|
125
|
+
<template #first>
|
|
126
|
+
<div style="padding: 16px;">上方面板</div>
|
|
127
|
+
</template>
|
|
128
|
+
<template #last>
|
|
129
|
+
<div style="padding: 16px;">下方面板</div>
|
|
130
|
+
</template>
|
|
131
|
+
</Split>
|
|
132
|
+
</template>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 拖拽范围限制
|
|
136
|
+
**场景**: 限制侧栏宽度的后台布局
|
|
137
|
+
|
|
138
|
+
限制面板最小和最大尺寸。
|
|
139
|
+
|
|
140
|
+
**使用的 API**: 属性: firstSize, min, max | 插槽: first, last
|
|
141
|
+
|
|
142
|
+
```vue
|
|
143
|
+
<template>
|
|
144
|
+
<Split firstSize="240px" :min="120" :max="480" style="height: 320px; border: 1px solid #eee;">
|
|
145
|
+
<template #first>
|
|
146
|
+
<div style="padding: 16px;">可拖拽但不小于 120px</div>
|
|
147
|
+
</template>
|
|
148
|
+
<template #last>
|
|
149
|
+
<div style="padding: 16px;">主面板</div>
|
|
150
|
+
</template>
|
|
151
|
+
</Split>
|
|
152
|
+
</template>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## 相关组件
|
|
156
|
+
Layout, Grid, Card
|
|
157
|
+
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# SSH 密钥选择 (SSHKeys)
|
|
2
|
+
|
|
3
|
+
用于拉取并选择 SSH 密钥的业务组件,适合实例创建、重置登录方式和批量授权等需要登录凭证选择的场景。
|
|
4
|
+
|
|
5
|
+
**关键词**: ssh keys, ssh key, SSH 密钥, 登录凭证, 密钥选择, ssh credential, 密钥下拉, linux 登录
|
|
6
|
+
|
|
7
|
+
**使用场景**: 实例创建 SSH 登录凭证选择、批量实例登录方式配置、禁用不合规密钥选项、选择后联动密钥实体信息
|
|
8
|
+
|
|
9
|
+
## 导入语句
|
|
10
|
+
```typescript
|
|
11
|
+
import { SSHKeys } from '@ksyun-internal/versatile';
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## 属性 (Props)
|
|
15
|
+
| 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
|
|
16
|
+
| --- | --- | --- | --- | --- | --- | --- |
|
|
17
|
+
| modelValue | `string` | `undefined` | 否 | 当前选中的密钥 ID | - | - |
|
|
18
|
+
| href | `string` | `undefined` | 否 | 跳转到密钥管理页的链接 | - | - |
|
|
19
|
+
| disableOption | `any` | `undefined` | 否 | 禁用选项的配置或函数 | - | - |
|
|
20
|
+
|
|
21
|
+
## 事件 (Events)
|
|
22
|
+
| 事件名 | Vue事件名 | 说明 | 回调参数 | 示例 |
|
|
23
|
+
| --- | --- | --- | --- | --- |
|
|
24
|
+
| update:modelValue | `@update:modelValue` | 所选 SSH 密钥 ID 变化时触发,可直接同步表单主值。 | `value?: string` | - |
|
|
25
|
+
| update:key | `@update:key` | 所选完整密钥对象变化时触发,便于读取密钥名称、指纹等信息。 | `value?: SSHKeyItem` | - |
|
|
26
|
+
|
|
27
|
+
### 事件参数说明
|
|
28
|
+
**update:modelValue**
|
|
29
|
+
|
|
30
|
+
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
|
31
|
+
| --- | --- | --- | --- | --- |
|
|
32
|
+
| value | `string` | 否 | - | 当前选中的 SSH 密钥 ID。 |
|
|
33
|
+
|
|
34
|
+
**update:key**
|
|
35
|
+
|
|
36
|
+
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
|
37
|
+
| --- | --- | --- | --- | --- |
|
|
38
|
+
| value | `SSHKeyItem` | 否 | - | 当前选中的完整 SSH 密钥对象。 |
|
|
39
|
+
|
|
40
|
+
## 使用示例
|
|
41
|
+
### 创建实例时选择 SSH 密钥
|
|
42
|
+
**场景**: 在创建 Linux 实例时选择已有 SSH 密钥作为登录凭证。
|
|
43
|
+
|
|
44
|
+
把 SSH 密钥选择作为登录方式的一部分。
|
|
45
|
+
|
|
46
|
+
**使用的 API**: 属性: modelValue, href | 事件: update:modelValue, update:key
|
|
47
|
+
|
|
48
|
+
```vue
|
|
49
|
+
<script setup lang="ts">
|
|
50
|
+
import { ref } from 'vue';
|
|
51
|
+
import { SSHKeys } from '@ksyun-internal/versatile';
|
|
52
|
+
|
|
53
|
+
const keyId = ref('key-001');
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<template>
|
|
57
|
+
<SSHKeys v-model="keyId" href="/ssh-key/list" />
|
|
58
|
+
</template>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 禁用不合规的 SSH 密钥
|
|
62
|
+
**场景**: 在创建实例时禁用过期或不符合规范的 SSH 密钥。
|
|
63
|
+
|
|
64
|
+
根据业务规则禁用部分密钥选项,避免被误选。
|
|
65
|
+
|
|
66
|
+
**使用的 API**: 属性: modelValue, href, disableOption | 事件: update:modelValue, update:key
|
|
67
|
+
|
|
68
|
+
```vue
|
|
69
|
+
<script setup lang="ts">
|
|
70
|
+
import { ref } from 'vue';
|
|
71
|
+
import { SSHKeys } from '@ksyun-internal/versatile';
|
|
72
|
+
|
|
73
|
+
const keyId = ref('');
|
|
74
|
+
const disableOption = (item: { expired?: boolean }) => Boolean(item?.expired);
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<template>
|
|
78
|
+
<SSHKeys
|
|
79
|
+
v-model="keyId"
|
|
80
|
+
href="/ssh-key/list"
|
|
81
|
+
:disable-option="disableOption"
|
|
82
|
+
/>
|
|
83
|
+
</template>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## 相关组件
|
|
87
|
+
Projects
|
|
88
|
+
|
|
@@ -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,13 +12,13 @@ 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
|
|
@@ -29,16 +29,19 @@ import { Steps, Step } from '@king-design/vue';
|
|
|
29
29
|
| title | `string` | 步骤标题 | `<Step title="步骤1" />` |
|
|
30
30
|
|
|
31
31
|
## 常见错误与正确用法 (Anti-Hallucination)
|
|
32
|
+
### value 从 1 开始而非 0
|
|
32
33
|
> **错误用法**: `const current = ref(1); // 期望第一步
|
|
33
34
|
<Steps :value="current">`
|
|
34
35
|
> **正确写法**: `const current = ref(0); // 第一步
|
|
35
36
|
<Steps :value="current">`
|
|
36
37
|
> **说明**: Steps 的 value 从 0 开始,0 表示第一步
|
|
37
38
|
|
|
39
|
+
### 使用 clickable 但未用 v-model
|
|
38
40
|
> **错误用法**: `<Steps :value="current" clickable> <!-- 点击不会改变值 -->`
|
|
39
41
|
> **正确写法**: `<Steps v-model="current" clickable>`
|
|
40
42
|
> **说明**: 使用 clickable 时需要用 v-model 进行双向绑定才能响应点击
|
|
41
43
|
|
|
44
|
+
### type 值拼写错误
|
|
42
45
|
> **错误用法**: `<Steps type="compact">`
|
|
43
46
|
> **正确写法**: `<Steps type="line-compact">`
|
|
44
47
|
> **说明**: type 只支持 default, line, simple, line-compact
|