king-design-analyzer 2.2.0 → 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.
Files changed (149) hide show
  1. package/components/actions.json +8 -0
  2. package/components/advancedset.json +1 -0
  3. package/components/affix.json +1 -0
  4. package/components/anchor.json +220 -0
  5. package/components/anchorlink.json +111 -0
  6. package/components/badge.json +1 -0
  7. package/components/breadcrumb.json +2 -1
  8. package/components/button.json +1 -0
  9. package/components/buttonlink.json +1 -0
  10. package/components/card.json +6 -3
  11. package/components/cardcontent.json +5 -0
  12. package/components/cascader.json +56 -0
  13. package/components/collapse.json +335 -348
  14. package/components/configprovider.json +96 -0
  15. package/components/copyrow.json +1 -0
  16. package/components/descriptions.json +10 -3
  17. package/components/diagram.json +295 -0
  18. package/components/dialog.json +4 -0
  19. package/components/divider.json +1 -0
  20. package/components/drawer.json +32 -0
  21. package/components/dropdown.json +4 -4
  22. package/components/flex.json +1 -0
  23. package/components/form.json +12 -3
  24. package/components/header.json +4 -0
  25. package/components/input.json +8 -4
  26. package/components/layoutcontent.json +9 -0
  27. package/components/layoutlistcontent.json +9 -0
  28. package/components/layoutpermissioncontent.json +1 -0
  29. package/components/layoutstandardlist.json +1 -0
  30. package/components/lazymount.json +1 -0
  31. package/components/lazyteleport.json +1 -0
  32. package/components/menu.json +4 -3
  33. package/components/notification.json +351 -0
  34. package/components/protable.json +2 -0
  35. package/components/rate.json +1 -0
  36. package/components/scrollselect.json +140 -0
  37. package/components/select.json +63 -0
  38. package/components/skeleton.json +1 -0
  39. package/components/slider.json +12 -2
  40. package/components/spin.json +2 -1
  41. package/components/spinner.json +419 -429
  42. package/components/split.json +3 -0
  43. package/components/switch.json +4 -2
  44. package/components/table.json +6 -1
  45. package/components/tabs.json +2 -2
  46. package/components/tag.json +8 -5
  47. package/components/timeline.json +3 -1
  48. package/components/tip.json +20 -0
  49. package/components/tooltip.json +8 -0
  50. package/components/transfer.json +52 -5
  51. package/components/tree.json +22 -1
  52. package/components/treeselect.json +56 -0
  53. package/components/vdialog.json +1 -0
  54. package/components/vdrawer.json +4 -0
  55. package/dist/ast/index.d.mts +30 -1
  56. package/dist/ast/index.d.ts +30 -1
  57. package/dist/ast/index.js +3 -3
  58. package/dist/ast/index.mjs +1 -1
  59. package/dist/{chunk-BI5TIQID.mjs → chunk-4OTQAQ6J.mjs} +13 -2
  60. package/dist/{chunk-CJGGFVQJ.js → chunk-4WXOYU2N.js} +31 -8
  61. package/dist/chunk-6HOIRUQB.mjs +409 -0
  62. package/dist/{chunk-CR3GC4H3.js → chunk-DHLWNT53.js} +13 -2
  63. package/dist/{chunk-KMIDURUR.mjs → chunk-IPJJMPOO.mjs} +113 -19
  64. package/dist/{chunk-TA3SV4SP.js → chunk-JJ6AB4ZH.js} +2 -2
  65. package/dist/{chunk-SZYVGYKK.js → chunk-JNRGUR3O.js} +113 -19
  66. package/dist/{chunk-XGPHQHLR.mjs → chunk-LRTDTFFQ.mjs} +27 -4
  67. package/dist/{chunk-3LYQ5XFM.mjs → chunk-NZL6T22V.mjs} +1 -1
  68. package/dist/chunk-V5N65MRP.js +411 -0
  69. package/dist/full/index.d.mts +2 -0
  70. package/dist/full/index.d.ts +2 -0
  71. package/dist/full/index.js +6 -6
  72. package/dist/full/index.mjs +4 -4
  73. package/dist/index.js +13 -13
  74. package/dist/index.mjs +5 -5
  75. package/dist/metadata/index.d.mts +17 -2
  76. package/dist/metadata/index.d.ts +17 -2
  77. package/dist/runtime/index.d.mts +2 -0
  78. package/dist/runtime/index.d.ts +2 -0
  79. package/dist/runtime/index.js +4 -4
  80. package/dist/runtime/index.mjs +2 -2
  81. package/dist/static/index.js +5 -5
  82. package/dist/static/index.mjs +2 -2
  83. package/docs_for_llm/actions.doc.md +11 -1
  84. package/docs_for_llm/advancedset.doc.md +10 -1
  85. package/docs_for_llm/affix.doc.md +5 -0
  86. package/docs_for_llm/anchor.doc.md +155 -0
  87. package/docs_for_llm/anchorlink.doc.md +75 -0
  88. package/docs_for_llm/badge.doc.md +5 -0
  89. package/docs_for_llm/breadcrumb.doc.md +74 -1
  90. package/docs_for_llm/button.doc.md +57 -0
  91. package/docs_for_llm/buttonlink.doc.md +10 -1
  92. package/docs_for_llm/card.doc.md +50 -3
  93. package/docs_for_llm/cardcontent.doc.md +21 -0
  94. package/docs_for_llm/carousel.doc.md +71 -0
  95. package/docs_for_llm/cascader.doc.md +62 -0
  96. package/docs_for_llm/collapse.doc.md +138 -8
  97. package/docs_for_llm/configprovider.doc.md +77 -0
  98. package/docs_for_llm/copyrow.doc.md +10 -1
  99. package/docs_for_llm/datepicker.doc.md +19 -0
  100. package/docs_for_llm/descriptions.doc.md +113 -4
  101. package/docs_for_llm/diagram.doc.md +343 -0
  102. package/docs_for_llm/dialog.doc.md +49 -0
  103. package/docs_for_llm/divider.doc.md +5 -0
  104. package/docs_for_llm/drawer.doc.md +86 -0
  105. package/docs_for_llm/dropdown.doc.md +240 -3
  106. package/docs_for_llm/flex.doc.md +10 -1
  107. package/docs_for_llm/form.doc.md +163 -4
  108. package/docs_for_llm/formitemspinner.doc.md +1 -1
  109. package/docs_for_llm/grid.doc.md +71 -0
  110. package/docs_for_llm/header.doc.md +33 -4
  111. package/docs_for_llm/input.doc.md +109 -2
  112. package/docs_for_llm/layoutcontent.doc.md +37 -0
  113. package/docs_for_llm/layoutlistcontent.doc.md +82 -9
  114. package/docs_for_llm/layoutpermissioncontent.doc.md +10 -1
  115. package/docs_for_llm/layoutstandardlist.doc.md +10 -1
  116. package/docs_for_llm/lazymount.doc.md +10 -1
  117. package/docs_for_llm/lazyteleport.doc.md +10 -1
  118. package/docs_for_llm/menu.doc.md +125 -3
  119. package/docs_for_llm/message.doc.md +45 -0
  120. package/docs_for_llm/notification.doc.md +214 -0
  121. package/docs_for_llm/protable.doc.md +9 -0
  122. package/docs_for_llm/rate.doc.md +5 -0
  123. package/docs_for_llm/scrollselect.doc.md +90 -0
  124. package/docs_for_llm/select.doc.md +174 -0
  125. package/docs_for_llm/skeleton.doc.md +35 -0
  126. package/docs_for_llm/slider.doc.md +11 -1
  127. package/docs_for_llm/spin.doc.md +10 -1
  128. package/docs_for_llm/spinner.doc.md +1 -1
  129. package/docs_for_llm/split.doc.md +13 -0
  130. package/docs_for_llm/steps.doc.md +71 -0
  131. package/docs_for_llm/switch.doc.md +15 -2
  132. package/docs_for_llm/table.doc.md +199 -4
  133. package/docs_for_llm/tabs.doc.md +98 -2
  134. package/docs_for_llm/tag.doc.md +148 -5
  135. package/docs_for_llm/timeline.doc.md +80 -2
  136. package/docs_for_llm/timepicker.doc.md +19 -0
  137. package/docs_for_llm/tip.doc.md +30 -0
  138. package/docs_for_llm/tooltip.doc.md +46 -0
  139. package/docs_for_llm/tour.doc.md +78 -0
  140. package/docs_for_llm/transfer.doc.md +59 -4
  141. package/docs_for_llm/tree.doc.md +64 -1
  142. package/docs_for_llm/treeselect.doc.md +68 -0
  143. package/docs_for_llm/upload.doc.md +7 -0
  144. package/docs_for_llm/vdialog.doc.md +26 -1
  145. package/docs_for_llm/vdrawer.doc.md +33 -4
  146. package/docs_for_llm/virtuallist.doc.md +151 -0
  147. package/package.json +3 -3
  148. package/dist/chunk-D2SXGGTX.mjs +0 -162
  149. package/dist/chunk-EYKZY2F3.js +0 -164
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var chunkTA3SV4SP_js = require('./chunk-TA3SV4SP.js');
3
+ var chunkJJ6AB4ZH_js = require('./chunk-JJ6AB4ZH.js');
4
4
  require('./chunk-YTEYDSDW.js');
5
- var chunkCJGGFVQJ_js = require('./chunk-CJGGFVQJ.js');
6
- var chunkSZYVGYKK_js = require('./chunk-SZYVGYKK.js');
7
- var chunkEYKZY2F3_js = require('./chunk-EYKZY2F3.js');
8
- var chunkCR3GC4H3_js = require('./chunk-CR3GC4H3.js');
5
+ var chunk4WXOYU2N_js = require('./chunk-4WXOYU2N.js');
6
+ var chunkJNRGUR3O_js = require('./chunk-JNRGUR3O.js');
7
+ var chunkV5N65MRP_js = require('./chunk-V5N65MRP.js');
8
+ var chunkDHLWNT53_js = require('./chunk-DHLWNT53.js');
9
9
  require('./chunk-KF5YBEM5.js');
10
10
  require('./chunk-JSBRDJBE.js');
11
11
 
@@ -13,33 +13,33 @@ require('./chunk-JSBRDJBE.js');
13
13
 
14
14
  Object.defineProperty(exports, "validateCompilation", {
15
15
  enumerable: true,
16
- get: function () { return chunkTA3SV4SP_js.validateCompilation; }
16
+ get: function () { return chunkJJ6AB4ZH_js.validateCompilation; }
17
17
  });
18
18
  Object.defineProperty(exports, "validateCode", {
19
19
  enumerable: true,
20
- get: function () { return chunkCJGGFVQJ_js.validateCode; }
20
+ get: function () { return chunk4WXOYU2N_js.validateCode; }
21
21
  });
22
22
  Object.defineProperty(exports, "validateCodeSync", {
23
23
  enumerable: true,
24
- get: function () { return chunkCJGGFVQJ_js.validateCodeSync; }
24
+ get: function () { return chunk4WXOYU2N_js.validateCodeSync; }
25
25
  });
26
26
  Object.defineProperty(exports, "analyzeCodeWithAST", {
27
27
  enumerable: true,
28
- get: function () { return chunkSZYVGYKK_js.analyzeCodeWithAST; }
28
+ get: function () { return chunkJNRGUR3O_js.analyzeCodeWithAST; }
29
29
  });
30
30
  Object.defineProperty(exports, "componentRegistry", {
31
31
  enumerable: true,
32
- get: function () { return chunkSZYVGYKK_js.componentRegistry; }
32
+ get: function () { return chunkJNRGUR3O_js.componentRegistry; }
33
33
  });
34
34
  Object.defineProperty(exports, "validateRuntimePrecheck", {
35
35
  enumerable: true,
36
- get: function () { return chunkEYKZY2F3_js.validateRuntimePrecheck; }
36
+ get: function () { return chunkV5N65MRP_js.validateRuntimePrecheck; }
37
37
  });
38
38
  Object.defineProperty(exports, "compileSFC", {
39
39
  enumerable: true,
40
- get: function () { return chunkCR3GC4H3_js.compileSFC; }
40
+ get: function () { return chunkDHLWNT53_js.compileSFC; }
41
41
  });
42
42
  Object.defineProperty(exports, "scopeStyles", {
43
43
  enumerable: true,
44
- get: function () { return chunkCR3GC4H3_js.scopeStyles; }
44
+ get: function () { return chunkDHLWNT53_js.scopeStyles; }
45
45
  });
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
- export { validateCompilation } from './chunk-3LYQ5XFM.mjs';
1
+ export { validateCompilation } from './chunk-NZL6T22V.mjs';
2
2
  import './chunk-5H7N2A5X.mjs';
3
- export { validateCode, validateCodeSync } from './chunk-XGPHQHLR.mjs';
4
- export { analyzeCodeWithAST, componentRegistry } from './chunk-KMIDURUR.mjs';
5
- export { validateRuntimePrecheck } from './chunk-D2SXGGTX.mjs';
6
- export { compileSFC, scopeStyles } from './chunk-BI5TIQID.mjs';
3
+ export { validateCode, validateCodeSync } from './chunk-LRTDTFFQ.mjs';
4
+ export { analyzeCodeWithAST, componentRegistry } from './chunk-IPJJMPOO.mjs';
5
+ export { validateRuntimePrecheck } from './chunk-6HOIRUQB.mjs';
6
+ export { compileSFC, scopeStyles } from './chunk-4OTQAQ6J.mjs';
7
7
  import './chunk-QC6VTSA3.mjs';
8
8
  import './chunk-UJCSKKID.mjs';
@@ -51,6 +51,21 @@ interface ComponentSlot {
51
51
  description: string;
52
52
  vueTemplate?: string;
53
53
  usageExample?: string;
54
+ bindingType?: 'array' | 'object' | 'single' | 'none';
55
+ slotProps?: {
56
+ name: string;
57
+ type?: string;
58
+ description?: string;
59
+ destructuringExample?: string;
60
+ }[];
61
+ }
62
+ interface ComponentSubComponent {
63
+ name: string;
64
+ description: string;
65
+ props?: ComponentProp[];
66
+ events?: ComponentEvent[];
67
+ slots?: ComponentSlot[];
68
+ methods?: ComponentMethod[];
54
69
  }
55
70
  interface ComponentMetadata {
56
71
  id: string;
@@ -64,7 +79,7 @@ interface ComponentMetadata {
64
79
  slots: ComponentSlot[];
65
80
  methods?: ComponentMethod[];
66
81
  examples?: any[];
67
- subComponents?: any[];
82
+ subComponents?: ComponentSubComponent[];
68
83
  commonMistakes?: any[];
69
84
  searchKeywords?: string[];
70
85
  useCases?: string[];
@@ -94,4 +109,4 @@ declare function getComponentsDir(): string;
94
109
  */
95
110
  declare function getComponentPath(componentName: string): string;
96
111
 
97
- export { type ComponentActionParam, type ComponentEvent, type ComponentMetadata, type ComponentMethod, type ComponentProp, type ComponentSlot, getAllComponentsMetadata, getComponentMetadata, getComponentPath, getComponentsDir, getComponentsList };
112
+ export { type ComponentActionParam, type ComponentEvent, type ComponentMetadata, type ComponentMethod, type ComponentProp, type ComponentSlot, type ComponentSubComponent, getAllComponentsMetadata, getComponentMetadata, getComponentPath, getComponentsDir, getComponentsList };
@@ -51,6 +51,21 @@ interface ComponentSlot {
51
51
  description: string;
52
52
  vueTemplate?: string;
53
53
  usageExample?: string;
54
+ bindingType?: 'array' | 'object' | 'single' | 'none';
55
+ slotProps?: {
56
+ name: string;
57
+ type?: string;
58
+ description?: string;
59
+ destructuringExample?: string;
60
+ }[];
61
+ }
62
+ interface ComponentSubComponent {
63
+ name: string;
64
+ description: string;
65
+ props?: ComponentProp[];
66
+ events?: ComponentEvent[];
67
+ slots?: ComponentSlot[];
68
+ methods?: ComponentMethod[];
54
69
  }
55
70
  interface ComponentMetadata {
56
71
  id: string;
@@ -64,7 +79,7 @@ interface ComponentMetadata {
64
79
  slots: ComponentSlot[];
65
80
  methods?: ComponentMethod[];
66
81
  examples?: any[];
67
- subComponents?: any[];
82
+ subComponents?: ComponentSubComponent[];
68
83
  commonMistakes?: any[];
69
84
  searchKeywords?: string[];
70
85
  useCases?: string[];
@@ -94,4 +109,4 @@ declare function getComponentsDir(): string;
94
109
  */
95
110
  declare function getComponentPath(componentName: string): string;
96
111
 
97
- export { type ComponentActionParam, type ComponentEvent, type ComponentMetadata, type ComponentMethod, type ComponentProp, type ComponentSlot, getAllComponentsMetadata, getComponentMetadata, getComponentPath, getComponentsDir, getComponentsList };
112
+ export { type ComponentActionParam, type ComponentEvent, type ComponentMetadata, type ComponentMethod, type ComponentProp, type ComponentSlot, type ComponentSubComponent, getAllComponentsMetadata, getComponentMetadata, getComponentPath, getComponentsDir, getComponentsList };
@@ -4,6 +4,8 @@ interface ValidationLayer {
4
4
  name: string;
5
5
  passed: boolean;
6
6
  errors: string[];
7
+ warnings?: string[];
8
+ status?: 'passed' | 'failed' | 'env_dependent' | 'runtime_skipped';
7
9
  }
8
10
  /**
9
11
  * 运行时预检查 (模拟执行)
@@ -4,6 +4,8 @@ interface ValidationLayer {
4
4
  name: string;
5
5
  passed: boolean;
6
6
  errors: string[];
7
+ warnings?: string[];
8
+ status?: 'passed' | 'failed' | 'env_dependent' | 'runtime_skipped';
7
9
  }
8
10
  /**
9
11
  * 运行时预检查 (模拟执行)
@@ -1,16 +1,16 @@
1
1
  'use strict';
2
2
 
3
- var chunkEYKZY2F3_js = require('../chunk-EYKZY2F3.js');
4
- var chunkCR3GC4H3_js = require('../chunk-CR3GC4H3.js');
3
+ var chunkV5N65MRP_js = require('../chunk-V5N65MRP.js');
4
+ var chunkDHLWNT53_js = require('../chunk-DHLWNT53.js');
5
5
  require('../chunk-JSBRDJBE.js');
6
6
 
7
7
 
8
8
 
9
9
  Object.defineProperty(exports, "validateRuntimePrecheck", {
10
10
  enumerable: true,
11
- get: function () { return chunkEYKZY2F3_js.validateRuntimePrecheck; }
11
+ get: function () { return chunkV5N65MRP_js.validateRuntimePrecheck; }
12
12
  });
13
13
  Object.defineProperty(exports, "compileSFC", {
14
14
  enumerable: true,
15
- get: function () { return chunkCR3GC4H3_js.compileSFC; }
15
+ get: function () { return chunkDHLWNT53_js.compileSFC; }
16
16
  });
@@ -1,3 +1,3 @@
1
- export { validateRuntimePrecheck } from '../chunk-D2SXGGTX.mjs';
2
- export { compileSFC } from '../chunk-BI5TIQID.mjs';
1
+ export { validateRuntimePrecheck } from '../chunk-6HOIRUQB.mjs';
2
+ export { compileSFC } from '../chunk-4OTQAQ6J.mjs';
3
3
  import '../chunk-UJCSKKID.mjs';
@@ -1,20 +1,20 @@
1
1
  'use strict';
2
2
 
3
- var chunkTA3SV4SP_js = require('../chunk-TA3SV4SP.js');
4
- var chunkCR3GC4H3_js = require('../chunk-CR3GC4H3.js');
3
+ var chunkJJ6AB4ZH_js = require('../chunk-JJ6AB4ZH.js');
4
+ var chunkDHLWNT53_js = require('../chunk-DHLWNT53.js');
5
5
  require('../chunk-JSBRDJBE.js');
6
6
 
7
7
 
8
8
 
9
9
  Object.defineProperty(exports, "validateCompilation", {
10
10
  enumerable: true,
11
- get: function () { return chunkTA3SV4SP_js.validateCompilation; }
11
+ get: function () { return chunkJJ6AB4ZH_js.validateCompilation; }
12
12
  });
13
13
  Object.defineProperty(exports, "compileSFC", {
14
14
  enumerable: true,
15
- get: function () { return chunkCR3GC4H3_js.compileSFC; }
15
+ get: function () { return chunkDHLWNT53_js.compileSFC; }
16
16
  });
17
17
  Object.defineProperty(exports, "scopeStyles", {
18
18
  enumerable: true,
19
- get: function () { return chunkCR3GC4H3_js.scopeStyles; }
19
+ get: function () { return chunkDHLWNT53_js.scopeStyles; }
20
20
  });
@@ -1,3 +1,3 @@
1
- export { validateCompilation } from '../chunk-3LYQ5XFM.mjs';
2
- export { compileSFC, scopeStyles } from '../chunk-BI5TIQID.mjs';
1
+ export { validateCompilation } from '../chunk-NZL6T22V.mjs';
2
+ export { compileSFC, scopeStyles } from '../chunk-4OTQAQ6J.mjs';
3
3
  import '../chunk-UJCSKKID.mjs';
@@ -20,7 +20,17 @@ import { Actions } from '@ksyun-internal/versatile';
20
20
  ## 插槽 (Slots)
21
21
  | 插槽名 | 说明 | 模板写法 | 示例 |
22
22
  | --- | --- | --- | --- |
23
- | btnText | 自定义按钮文案渲染 | `<template #btnText="{ action }">...</template>` | - |
23
+ | btnText | 自定义按钮文案渲染 | `<template #btnText="{ action }">...</template>` | `<Actions>
24
+ <template <template #btnText="{ action }">...</template>>
25
+ {{ action }}
26
+ </template>
27
+ </Actions>` |
28
+
29
+ ### 插槽参数说明
30
+ **btnText**
31
+
32
+ - 参数结构: <template #btnText="{ action }">...</template>
33
+ - 参数列表: `action: ActionConfig`
24
34
 
25
35
  ## 使用示例
26
36
  ### 表格操作列中的主次操作
@@ -33,7 +33,16 @@ import { AdvancedSet } from '@ksyun-internal/versatile';
33
33
  ## 插槽 (Slots)
34
34
  | 插槽名 | 说明 | 模板写法 | 示例 |
35
35
  | --- | --- | --- | --- |
36
- | default | 高级设置内容区域 | `<AdvancedSet>...</AdvancedSet>` | - |
36
+ | default | 高级设置内容区域 | `<AdvancedSet>...</AdvancedSet>` | `<AdvancedSet>
37
+ <template <AdvancedSet>...</AdvancedSet>>
38
+ 自定义default内容
39
+ </template>
40
+ </AdvancedSet>` |
41
+
42
+ ### 插槽参数说明
43
+ **default**
44
+
45
+ - 参数结构: 无参数
37
46
 
38
47
  ## 使用示例
39
48
  ### 购买页中的高级设置折叠区
@@ -37,6 +37,11 @@ import { Affix } from '@king-design/vue';
37
37
  | --- | --- | --- | --- |
38
38
  | default | 需要被固定的元素 | `#default` | `<Affix><Button>Fixed Button</Button></Affix>` |
39
39
 
40
+ ### 插槽参数说明
41
+ **default**
42
+
43
+ - 参数结构: 无参数
44
+
40
45
  ## 常见错误与正确用法 (Anti-Hallucination)
41
46
  ### 父容器滚动问题
42
47
  > **错误用法**: `<div style="overflow: auto; height: 200px;">
@@ -0,0 +1,155 @@
1
+ # 锚点导航 (Anchor)
2
+
3
+ 锚点导航组件,用于监听页面滚动位置并高亮当前锚点。支持自定义滚动容器、偏移量、横向或纵向模式,通常与 AnchorLink 配合使用。
4
+
5
+ **关键词**: anchor, 锚点, 目录导航, 滚动定位, AnchorLink
6
+
7
+ **使用场景**: 长页面章节导航、文档目录定位、详情页内容分区跳转
8
+
9
+ ## 导入语句
10
+ ```typescript
11
+ import { Anchor, AnchorLink } from '@king-design/vue';
12
+ ```
13
+
14
+ ## 属性 (Props)
15
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
16
+ | --- | --- | --- | --- | --- | --- | --- |
17
+ | value | `string` | `undefined` | 否 | 当前激活的锚点 href,可用 v-model 双向绑定 | - | `<Anchor v-model="currentLink"></Anchor>` |
18
+ | offset | `number` | `0` | 否 | 滚动定位偏移量,适合页面存在固定头部时使用 | - | `<Anchor :offset="64"></Anchor>` |
19
+ | container | `string | HTMLElement` | `window` | 否 | 监听滚动的容器,可传选择器或 HTMLElement | - | `<Anchor container="#scroll-container"></Anchor>` |
20
+ | threshold | `number` | `0` | 否 | 激活锚点时的阈值范围 | - | `<Anchor :threshold="20"></Anchor>` |
21
+ | vertical | `boolean` | `true` | 否 | 是否使用纵向模式,默认开启;传 false 时为横向模式 | - | `<Anchor :vertical="false"></Anchor>` |
22
+ | size | `Sizes` | `"default"` | 否 | 导航尺寸 | - | `<Anchor size="small"></Anchor>` |
23
+ | duration | `number` | `300` | 否 | 点击锚点后的滚动动画时长,单位 ms | - | `<Anchor :duration="500"></Anchor>` |
24
+
25
+ ## 事件 (Events)
26
+ | 事件名 | Vue事件名 | 说明 | 回调参数 | 示例 |
27
+ | --- | --- | --- | --- | --- |
28
+ | change | `@change` | 当前激活锚点变化时触发 | `href: string` | `<Anchor @change="handleChange"></Anchor>` |
29
+ | click | `@click` | 点击锚点链接时触发 | `e: MouseEvent, link: AnchorLinkProps` | `<Anchor @click="handleClick"></Anchor>` |
30
+
31
+ ### 事件参数说明
32
+ **change**
33
+
34
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
35
+ | --- | --- | --- | --- | --- |
36
+ | href | `string` | 是 | - | 当前激活锚点 href |
37
+
38
+ 事件处理示例:
39
+ ```typescript
40
+ const handleChange = (href: string) => {
41
+ console.log('当前锚点', href);
42
+ };
43
+ ```
44
+
45
+ **click**
46
+
47
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
48
+ | --- | --- | --- | --- | --- |
49
+ | e | `MouseEvent` | 是 | - | 原生鼠标事件 |
50
+ | link | `AnchorLinkProps` | 是 | - | 被点击的锚点配置 |
51
+
52
+ 事件处理示例:
53
+ ```typescript
54
+ const handleClick = (e: MouseEvent, link: { href?: string }) => {
55
+ console.log('点击了锚点', link.href);
56
+ };
57
+ ```
58
+
59
+ ## 插槽 (Slots)
60
+ | 插槽名 | 说明 | 模板写法 | 示例 |
61
+ | --- | --- | --- | --- |
62
+ | default | 锚点导航内容,通常放置一个或多个 AnchorLink | `#default` | `<Anchor>
63
+ <AnchorLink href="section1" title="Section 1" />
64
+ </Anchor>` |
65
+
66
+ ### 插槽参数说明
67
+ **default**
68
+
69
+ - 参数结构: 无参数
70
+
71
+ ## 方法 (Methods)
72
+ | 方法名 | 说明 | 参数 | 返回值 |
73
+ | --- | --- | --- | --- |
74
+ | getLinks | 获取当前 Anchor 中注册的所有 href | `-` | `string[]` |
75
+ | getTargetElement | 根据 href 查找对应的目标元素 | `href: string` | `HTMLElement | null` |
76
+
77
+ ### 方法参数说明
78
+ **getTargetElement**
79
+
80
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
81
+ | --- | --- | --- | --- | --- |
82
+ | href | `string` | 是 | - | 目标锚点 href |
83
+
84
+ 调用示例:
85
+ ```typescript
86
+ anchorRef.value?.getTargetElement('section2');
87
+ ```
88
+
89
+ ### 方法调用示例
90
+ **getLinks**
91
+
92
+ ```typescript
93
+ anchorRef.value?.getLinks();
94
+ ```
95
+
96
+ **getTargetElement**
97
+
98
+ ```typescript
99
+ anchorRef.value?.getTargetElement('section2');
100
+ ```
101
+
102
+ ## 使用示例
103
+ ### 基础用法
104
+ **场景**: 为详情页长内容区域提供目录导航。
105
+
106
+ 在滚动容器旁边展示纵向锚点导航。
107
+
108
+ **使用的 API**: 属性: value, container | 插槽: default
109
+
110
+ ```vue
111
+ <script setup lang="ts">
112
+ import { ref } from 'vue';
113
+ import { Anchor, AnchorLink } from '@king-design/vue';
114
+
115
+ const current = ref('section1');
116
+ </script>
117
+ <template>
118
+ <div style="display: flex; gap: 20px; align-items: flex-start;">
119
+ <div id="scroll-container" style="height: 240px; overflow-y: auto; width: 360px; border: 1px solid #eee; padding: 12px;">
120
+ <section id="section1" style="height: 180px;">第一部分</section>
121
+ <section id="section2" style="height: 180px;">第二部分</section>
122
+ <section id="section3" style="height: 180px;">第三部分</section>
123
+ </div>
124
+ <Anchor v-model="current" container="#scroll-container">
125
+ <AnchorLink href="section1" title="第一部分" />
126
+ <AnchorLink href="section2" title="第二部分" />
127
+ <AnchorLink href="section3" title="第三部分" />
128
+ </Anchor>
129
+ </div>
130
+ </template>
131
+ ```
132
+
133
+ ### 横向锚点
134
+ **场景**: 在页面头部展示横向章节切换导航。
135
+
136
+ 将 Anchor 作为横向导航栏使用。
137
+
138
+ **使用的 API**: 属性: vertical, offset | 插槽: default
139
+
140
+ ```vue
141
+ <script setup lang="ts">
142
+ import { Anchor, AnchorLink } from '@king-design/vue';
143
+ </script>
144
+ <template>
145
+ <Anchor :vertical="false" :offset="64">
146
+ <AnchorLink href="overview" title="概览" />
147
+ <AnchorLink href="spec" title="规格" />
148
+ <AnchorLink href="billing" title="计费" />
149
+ </Anchor>
150
+ </template>
151
+ ```
152
+
153
+ ## 相关组件
154
+ AnchorLink, Affix
155
+
@@ -0,0 +1,75 @@
1
+ # 锚点链接 (AnchorLink)
2
+
3
+ Anchor 的子链接组件,用于声明单个锚点项。支持标题、禁用态以及嵌套层级,通常作为 Anchor 的默认插槽子节点出现。
4
+
5
+ **关键词**: anchorlink, 锚点链接, 目录项, Anchor
6
+
7
+ **使用场景**: Anchor 子导航项、目录树层级导航
8
+
9
+ ## 导入语句
10
+ ```typescript
11
+ import { AnchorLink } from '@king-design/vue';
12
+ ```
13
+
14
+ ## 属性 (Props)
15
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
16
+ | --- | --- | --- | --- | --- | --- | --- |
17
+ | href | `string` | `undefined` | 否 | 目标元素的 id 或锚点标识 | - | `<AnchorLink href="section1" title="第一部分" />` |
18
+ | title | `string | VNode` | `undefined` | 否 | 链接标题内容 | - | `<AnchorLink href="billing" title="计费说明" />` |
19
+ | disabled | `boolean` | `false` | 否 | 是否禁用当前锚点链接 | - | `<AnchorLink href="advanced" title="高级设置" disabled />` |
20
+
21
+ ## 插槽 (Slots)
22
+ | 插槽名 | 说明 | 模板写法 | 示例 |
23
+ | --- | --- | --- | --- |
24
+ | default | 自定义链接内容;未设置 title 时可直接通过默认插槽传入文字或节点 | `#default` | `<AnchorLink href="section2">第二部分</AnchorLink>` |
25
+
26
+ ### 插槽参数说明
27
+ **default**
28
+
29
+ - 参数结构: 无参数
30
+
31
+ ## 使用示例
32
+ ### 基础链接
33
+ **场景**: 为章节导航添加单个可点击锚点项。
34
+
35
+ 在 Anchor 中声明单个锚点链接。
36
+
37
+ **使用的 API**: 属性: href, title | 插槽: default
38
+
39
+ ```vue
40
+ <script setup lang="ts">
41
+ import { Anchor, AnchorLink } from '@king-design/vue';
42
+ </script>
43
+ <template>
44
+ <Anchor>
45
+ <AnchorLink href="section1" title="第一部分" />
46
+ <AnchorLink href="section2">第二部分</AnchorLink>
47
+ </Anchor>
48
+ </template>
49
+ ```
50
+
51
+ ### 嵌套链接
52
+ **场景**: 构建多级目录结构的页面导航。
53
+
54
+ 在纵向 Anchor 中构建层级导航。
55
+
56
+ **使用的 API**: 属性: href, title | 插槽: default
57
+
58
+ ```vue
59
+ <script setup lang="ts">
60
+ import { Anchor, AnchorLink } from '@king-design/vue';
61
+ </script>
62
+ <template>
63
+ <Anchor>
64
+ <AnchorLink href="overview" title="概览">
65
+ <AnchorLink href="overview-base" title="基础信息" />
66
+ <AnchorLink href="overview-network" title="网络配置" />
67
+ </AnchorLink>
68
+ <AnchorLink href="billing" title="计费" />
69
+ </Anchor>
70
+ </template>
71
+ ```
72
+
73
+ ## 相关组件
74
+ Anchor
75
+
@@ -23,6 +23,11 @@ import { Badge } from '@king-design/vue';
23
23
  | --- | --- | --- | --- |
24
24
  | default | 徽标包裹的元素 | `#default` | `<Badge><Button>Button</Button></Badge>` |
25
25
 
26
+ ### 插槽参数说明
27
+ **default**
28
+
29
+ - 参数结构: 无参数
30
+
26
31
  ## 常见错误与正确用法 (Anti-Hallucination)
27
32
  ### 数字作为字符串传入
28
33
  > **错误用法**: `<Badge text="10" :max="9">`
@@ -19,16 +19,89 @@ import { Breadcrumb, BreadcrumbItem } from '@king-design/vue';
19
19
  ## 插槽 (Slots)
20
20
  | 插槽名 | 说明 | 模板写法 | 示例 |
21
21
  | --- | --- | --- | --- |
22
- | separator | 指定分隔符 | `undefined` | - |
22
+ | separator | 指定分隔符 | `#separator` | `<Breadcrumb>
23
+ <template #separator>
24
+ 自定义separator内容
25
+ </template>
26
+ </Breadcrumb>` |
27
+
28
+ ### 插槽参数说明
29
+ **separator**
30
+
31
+ - 参数结构: 无参数
23
32
 
24
33
  ## 子组件 (Sub-Components)
25
34
  ### BreadcrumbItem
26
35
  面包屑项组件,用于定义导航路径中的每一项
27
36
 
37
+ #### 属性 (Props)
28
38
  | 属性名 | 类型 | 说明 | 示例 |
29
39
  | --- | --- | --- | --- |
30
40
  | to | `string | object` | 指定超链接地址,支持字符串路径或 Vue Router 路由对象 | `<BreadcrumbItem to="/products">产品中心</BreadcrumbItem>` |
31
41
 
42
+ #### 组合示例
43
+ ##### 带链接的面包屑
44
+ **场景**: 创建可点击跳转的面包屑导航
45
+
46
+ 点击可跳转的面包屑项
47
+
48
+ **命中的子组件 API**: 属性: to
49
+
50
+ ```vue
51
+ <script setup lang="ts">
52
+ import { Breadcrumb, BreadcrumbItem } from '@king-design/vue';
53
+ </script>
54
+ <template>
55
+ <Breadcrumb>
56
+ <BreadcrumbItem to="/">首页</BreadcrumbItem>
57
+ <BreadcrumbItem to="/products">产品中心</BreadcrumbItem>
58
+ <BreadcrumbItem>当前页面</BreadcrumbItem>
59
+ </Breadcrumb>
60
+ </template>
61
+ ```
62
+
63
+ ##### 配合 Vue Router
64
+ **场景**: 配合 Vue Router 使用路由对象导航
65
+
66
+ 使用路由对象进行导航
67
+
68
+ **命中的子组件 API**: 属性: to
69
+
70
+ ```vue
71
+ <script setup lang="ts">
72
+ import { Breadcrumb, BreadcrumbItem } from '@king-design/vue';
73
+ </script>
74
+ <template>
75
+ <Breadcrumb>
76
+ <BreadcrumbItem :to="{name: 'home'}">首页</BreadcrumbItem>
77
+ <BreadcrumbItem :to="{path: '/products'}">产品中心</BreadcrumbItem>
78
+ <BreadcrumbItem :to="{path: '/products/1', query: {id: 1}}">产品详情</BreadcrumbItem>
79
+ </Breadcrumb>
80
+ </template>
81
+ ```
82
+
83
+ ##### 带图标的首页
84
+ **场景**: 使用图标表示首页
85
+
86
+ 首页项使用图标代替文字
87
+
88
+ **命中的子组件 API**: 属性: to
89
+
90
+ ```vue
91
+ <script setup lang="ts">
92
+ import { Breadcrumb, BreadcrumbItem, Icon } from '@king-design/vue';
93
+ </script>
94
+ <template>
95
+ <Breadcrumb>
96
+ <BreadcrumbItem to="/">
97
+ <Icon class="k-icon-home" />
98
+ </BreadcrumbItem>
99
+ <BreadcrumbItem to="/products">产品中心</BreadcrumbItem>
100
+ <BreadcrumbItem>产品详情</BreadcrumbItem>
101
+ </Breadcrumb>
102
+ </template>
103
+ ```
104
+
32
105
  ## 常见错误与正确用法 (Anti-Hallucination)
33
106
  ### 最后一项不应该有链接
34
107
  > **错误用法**: `<Breadcrumb>