x-next 1.13.0 → 1.14.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.
Files changed (138) hide show
  1. package/AI_CODING.md +6 -5
  2. package/AI_USAGE/catalog.md +106 -105
  3. package/AI_USAGE/components/alert-api.md +48 -0
  4. package/AI_USAGE/components/alert.md +222 -3
  5. package/AI_USAGE/components/bar-chart-api.md +177 -0
  6. package/AI_USAGE/components/bar-chart.md +297 -3
  7. package/AI_USAGE/components/boxicons.md +147 -0
  8. package/AI_USAGE/components/button-api.md +144 -0
  9. package/AI_USAGE/components/button.md +447 -3
  10. package/AI_USAGE/components/charts.md +81 -0
  11. package/AI_USAGE/components/checkbox-api.md +145 -0
  12. package/AI_USAGE/components/checkbox.md +365 -3
  13. package/AI_USAGE/components/color-picker-api.md +52 -0
  14. package/AI_USAGE/components/color-picker.md +211 -3
  15. package/AI_USAGE/components/config-provider-api.md +38 -0
  16. package/AI_USAGE/components/config-provider.md +250 -3
  17. package/AI_USAGE/components/date-picker-api.md +1114 -0
  18. package/AI_USAGE/components/date-picker.md +378 -3
  19. package/AI_USAGE/components/dialog-api.md +142 -0
  20. package/AI_USAGE/components/dialog.md +284 -3
  21. package/AI_USAGE/components/draggable-api.md +146 -0
  22. package/AI_USAGE/components/draggable.md +259 -0
  23. package/AI_USAGE/components/drawer-api.md +78 -0
  24. package/AI_USAGE/components/drawer.md +227 -0
  25. package/AI_USAGE/components/dropdown-api.md +529 -0
  26. package/AI_USAGE/components/dropdown.md +392 -3
  27. package/AI_USAGE/components/empty-api.md +36 -0
  28. package/AI_USAGE/components/empty.md +227 -3
  29. package/AI_USAGE/components/finicon.md +88 -0
  30. package/AI_USAGE/components/form-api.md +524 -0
  31. package/AI_USAGE/components/form.md +454 -0
  32. package/AI_USAGE/components/grid-api.md +527 -0
  33. package/AI_USAGE/components/grid.md +224 -0
  34. package/AI_USAGE/components/heatmap-api.md +122 -0
  35. package/AI_USAGE/components/heatmap.md +220 -0
  36. package/AI_USAGE/components/icon-api.md +4707 -0
  37. package/AI_USAGE/components/icon.md +257 -0
  38. package/AI_USAGE/components/image-api.md +440 -0
  39. package/AI_USAGE/components/image.md +465 -0
  40. package/AI_USAGE/components/input-api.md +184 -0
  41. package/AI_USAGE/components/input-number-api.md +66 -0
  42. package/AI_USAGE/components/input-number.md +294 -0
  43. package/AI_USAGE/components/input-tag-api.md +114 -0
  44. package/AI_USAGE/components/input-tag.md +482 -0
  45. package/AI_USAGE/components/input.md +293 -3
  46. package/AI_USAGE/components/layout-api.md +147 -0
  47. package/AI_USAGE/components/layout.md +230 -0
  48. package/AI_USAGE/components/line-chart-api.md +197 -0
  49. package/AI_USAGE/components/line-chart.md +279 -3
  50. package/AI_USAGE/components/link-api.md +42 -0
  51. package/AI_USAGE/components/link.md +197 -0
  52. package/AI_USAGE/components/menu-api.md +516 -0
  53. package/AI_USAGE/components/menu.md +268 -0
  54. package/AI_USAGE/components/message-api.md +215 -0
  55. package/AI_USAGE/components/message-box-api.md +108 -0
  56. package/AI_USAGE/components/message-box.md +268 -3
  57. package/AI_USAGE/components/message.md +231 -3
  58. package/AI_USAGE/components/network-api.md +91 -0
  59. package/AI_USAGE/components/network.md +378 -0
  60. package/AI_USAGE/components/notification-api.md +236 -0
  61. package/AI_USAGE/components/notification.md +275 -3
  62. package/AI_USAGE/components/pagination-api.md +62 -0
  63. package/AI_USAGE/components/pagination.md +380 -3
  64. package/AI_USAGE/components/pie-chart-api.md +109 -0
  65. package/AI_USAGE/components/pie-chart.md +245 -3
  66. package/AI_USAGE/components/popconfirm-api.md +75 -0
  67. package/AI_USAGE/components/popconfirm.md +231 -3
  68. package/AI_USAGE/components/popover-api.md +75 -0
  69. package/AI_USAGE/components/popover.md +208 -3
  70. package/AI_USAGE/components/popup-api.md +75 -0
  71. package/AI_USAGE/components/popup.md +52 -0
  72. package/AI_USAGE/components/progress-api.md +44 -0
  73. package/AI_USAGE/components/progress.md +248 -3
  74. package/AI_USAGE/components/radio-api.md +165 -0
  75. package/AI_USAGE/components/radio.md +259 -3
  76. package/AI_USAGE/components/rate-api.md +54 -0
  77. package/AI_USAGE/components/rate.md +233 -3
  78. package/AI_USAGE/components/resize-box-api.md +56 -0
  79. package/AI_USAGE/components/resize-box.md +231 -0
  80. package/AI_USAGE/components/scrollbar-api.md +77 -0
  81. package/AI_USAGE/components/scrollbar.md +218 -0
  82. package/AI_USAGE/components/select-api.md +758 -0
  83. package/AI_USAGE/components/select.md +640 -3
  84. package/AI_USAGE/components/skeleton-api.md +85 -0
  85. package/AI_USAGE/components/skeleton.md +150 -0
  86. package/AI_USAGE/components/slider-api.md +51 -0
  87. package/AI_USAGE/components/slider.md +233 -3
  88. package/AI_USAGE/components/space-api.md +38 -0
  89. package/AI_USAGE/components/space.md +145 -0
  90. package/AI_USAGE/components/spin-api.md +43 -0
  91. package/AI_USAGE/components/spin.md +205 -0
  92. package/AI_USAGE/components/steps-api.md +111 -0
  93. package/AI_USAGE/components/steps.md +201 -3
  94. package/AI_USAGE/components/switch-api.md +58 -0
  95. package/AI_USAGE/components/switch.md +290 -3
  96. package/AI_USAGE/components/table-api.md +2919 -0
  97. package/AI_USAGE/components/table.md +1414 -0
  98. package/AI_USAGE/components/tabs-api.md +135 -0
  99. package/AI_USAGE/components/tabs.md +308 -3
  100. package/AI_USAGE/components/tag-api.md +124 -0
  101. package/AI_USAGE/components/tag.md +292 -0
  102. package/AI_USAGE/components/textarea-api.md +55 -0
  103. package/AI_USAGE/components/textarea.md +326 -3
  104. package/AI_USAGE/components/time-picker-api.md +137 -0
  105. package/AI_USAGE/components/time-picker.md +271 -3
  106. package/AI_USAGE/components/time-range-selector-api.md +44 -0
  107. package/AI_USAGE/components/time-range-selector.md +355 -0
  108. package/AI_USAGE/components/timeline-api.md +93 -0
  109. package/AI_USAGE/components/timeline.md +312 -0
  110. package/AI_USAGE/components/tooltip-api.md +77 -0
  111. package/AI_USAGE/components/tooltip.md +182 -0
  112. package/AI_USAGE/components/trend-chart-api.md +119 -0
  113. package/AI_USAGE/components/trend-chart.md +335 -0
  114. package/AI_USAGE/components/trigger-api.md +124 -0
  115. package/AI_USAGE/components/trigger.md +185 -0
  116. package/AI_USAGE/components/upload-api.md +200 -0
  117. package/AI_USAGE/components/upload.md +711 -3
  118. package/AI_USAGE/components/watermark-api.md +87 -0
  119. package/AI_USAGE/components/watermark.md +200 -0
  120. package/AI_USAGE/core.md +1 -1
  121. package/AI_USAGE/index.md +35 -7
  122. package/AI_USAGE/recipes/form-on-demand.md +1 -1
  123. package/AI_USAGE.md +33651 -5
  124. package/CHANGELOG.md +18 -0
  125. package/dist/_utils/inherit-component-type.d.ts +11 -0
  126. package/dist/components/date-picker/index.d.ts +420 -5
  127. package/dist/components/form-input/index.d.ts +617 -2
  128. package/dist/components/layout/index.d.ts +689 -1
  129. package/dist/components/menu/index.d.ts +786 -1
  130. package/dist/es/_utils/inherit-component-type.js +6 -0
  131. package/dist/es/components/date-picker/index.js +18 -17
  132. package/dist/es/components/form-input/index.js +12 -11
  133. package/dist/es/components/layout/index.js +10 -9
  134. package/dist/es/components/menu/hooks/use-level.js +5 -5
  135. package/dist/es/components/menu/index.js +13 -10
  136. package/dist/index.cjs +3 -3
  137. package/dist/index.umd.js +3 -3
  138. package/package.json +10 -5
@@ -0,0 +1,257 @@
1
+ <!-- Generated by pnpm generate:ai-usage. Edit script/ai-usage/content.md and script/ai-usage/. -->
2
+ # Icon AI 使用
3
+
4
+ 适用版本:x-next@1.14.0;来源指纹:`014984639d816a2c7e25eb22690c586b0b2e8efba6846bec8a4e424db41a09e9`。
5
+
6
+ 先读 [通用接入](../core.md)。公开导出:`Icon`;主要模型:无。完整 Props、Events、Slots、实例方法与服务签名见 [本地 API](./icon-api.md),包含本组件族全部子组件和别名。
7
+
8
+ 按需样式:`x-next/style/base.css`(包含 base.css)。代码块未单独引样式时在应用入口加载全量样式,或按实际所有组件加载 JS 入口;不要仅因复制一个组件页就漏掉其中的 Button 等组合依赖。
9
+
10
+ ## 场景用法
11
+
12
+ 以下示例从本地 `src/docs/components/icon.md` 显式导入到独立 AI 源,补齐局部注册、状态和样式后进行严格模板检查。上方已核验行为优先;原始 prop 默认值、包装透传和示例业务适配分别查 [完整 API](./icon-api.md) 与场景说明。类型通过不代表所有散文和交互已验证。
13
+
14
+ ### 用途与选型
15
+
16
+ 通过统一的 `name` 调用内置图标,适合按钮、输入框、反馈提示和业务自定义图标。
17
+
18
+
19
+ ### 何时使用
20
+
21
+ - 需要在组件中展示装饰性图形、状态图形或操作图形。
22
+ - 希望通过统一的尺寸、颜色、旋转和加载动画控制图标。
23
+ - 业务侧需要注册少量自定义 SVG,并以同一种方式调用。
24
+
25
+
26
+ ### 基础用法
27
+
28
+ ```vue
29
+ <script setup lang="ts">
30
+ import 'x-next/style.css';
31
+ import { Icon } from 'x-next';
32
+
33
+ </script>
34
+ <template>
35
+ <Icon name="x" />
36
+ <Icon name="check" />
37
+ <Icon name="search" />
38
+ <Icon name="loading" />
39
+ </template>
40
+ ```
41
+
42
+ ### 图标清单
43
+
44
+ 只展示每种图形的推荐名称,旧名仍可搜索和使用。点击复制推荐写法,避免在同一图形的多个名字间反复选择。
45
+
46
+ ### 推荐名称与旧名
47
+
48
+ | 推荐名称 | 兼容旧名 |
49
+ | --- | --- |
50
+ | `x` | `close` |
51
+ | `chevron-left / right / up / down` | `left / right / up / down` |
52
+ | `circle-check / circle-x / circle-alert / circle-minus` | `check-circle / close-circle / alert-circle / minus-circle` |
53
+ | `info` | `info-circle` |
54
+ | `loader-circle` | `loading-circle` |
55
+ | `pencil / lock-open / ellipsis` | `edit / unlock / more-horizontal` |
56
+ | `chevrons-left / chevrons-right` | `double-left / double-right` |
57
+ | `circle-question-mark` | `question-circle / circle-question` |
58
+ | `eye-off / clock` | `eye-invisible / clock-circle` |
59
+ | `rotate-ccw / rotate-cw` | `rotate-left / rotate-right` |
60
+
61
+ `arrow-*` 是带箭杆的方向箭头,`chevron-*` 是单折角,`chevrons-*` 是双折角。三个系列用途不同,分别保留。
62
+
63
+ `publicIconNames` 保留历史清单;新建图标选择器可使用 `canonicalIconNames`,需要兼容搜索时使用 `searchPublicIcons(keyword)`。旧名和推荐名始终引用同一份 SVG。
64
+
65
+ ```vue
66
+ <script setup lang="ts">
67
+ import 'x-next/style.css';
68
+ import { Icon } from 'x-next';
69
+ import { computed, ref } from 'vue';
70
+ import { Message, searchPublicIcons } from 'x-next';
71
+
72
+ const keyword = ref('');
73
+ const iconColor = ref('#000000');
74
+ const iconSize = ref(24);
75
+ const iconStrokeWidth = ref(2);
76
+
77
+ const filteredIcons = computed(() => searchPublicIcons(keyword.value));
78
+
79
+ const getIconCode = (name: string) =>
80
+ name === 'loader-circle' ? `<x-icon name="${name}" spin />` : `<x-icon name="${name}" />`;
81
+
82
+ const copyIconName = async (name: string) => {
83
+ const code = getIconCode(name);
84
+
85
+ try {
86
+ if (!navigator.clipboard?.writeText) throw new Error('Clipboard unavailable');
87
+ await navigator.clipboard.writeText(code);
88
+ Message.success(`已复制 ${code}`);
89
+ } catch {
90
+ Message.warning(`复制失败,请手动复制:${code}`);
91
+ }
92
+ };
93
+ </script>
94
+ <template>
95
+ <div
96
+ class="icon-browser"
97
+ :style="{
98
+ '--icon-color': iconColor,
99
+ '--icon-size': `${iconSize}px`,
100
+ }"
101
+ >
102
+ <section class="icon-customizer">
103
+ <label>
104
+ <span>Color</span>
105
+ <span>
106
+ <input v-model="iconColor" type="color" />
107
+ <code>{{ iconColor }}</code>
108
+ </span>
109
+ </label>
110
+ <label>
111
+ <span>Size</span>
112
+ <em>{{ iconSize }}px</em>
113
+ <input v-model.number="iconSize" type="range" min="16" max="44" step="2" />
114
+ </label>
115
+ <label>
116
+ <span>Stroke</span>
117
+ <em>{{ iconStrokeWidth }}</em>
118
+ <input v-model.number="iconStrokeWidth" type="range" min="1" max="3" step="0.25" />
119
+ </label>
120
+ </section>
121
+
122
+ <input v-model="keyword" placeholder="搜索图标名称" />
123
+
124
+ <div class="icon-grid">
125
+ <button
126
+ v-for="name in filteredIcons"
127
+ :key="name"
128
+ :title="getIconCode(name)"
129
+ @click="copyIconName(name)"
130
+ >
131
+ <Icon
132
+ :name="name"
133
+ :size="iconSize"
134
+ :stroke-width="iconStrokeWidth"
135
+ :spin="name === 'loader-circle'"
136
+ />
137
+ <span>{{ name }}</span>
138
+ </button>
139
+ </div>
140
+ </div>
141
+ </template>
142
+ ```
143
+
144
+ ### 尺寸和颜色
145
+
146
+ ```vue
147
+ <script setup lang="ts">
148
+ import 'x-next/style.css';
149
+ import { Icon } from 'x-next';
150
+
151
+ </script>
152
+ <template>
153
+ <Icon name="search" :size="14" />
154
+ <Icon name="search" :size="20" />
155
+ <Icon name="search" size="1.75em" />
156
+ <Icon name="circle-check" :size="22" color="var(--x-color-success-6)" />
157
+ <Icon name="circle-x" :size="22" color="var(--x-color-danger-6)" />
158
+ </template>
159
+ ```
160
+
161
+ ### 描边宽度
162
+
163
+ Lucide 线性图标默认描边为 2,可通过 `stroke-width` 调整。动态图标 `loading` 使用自身动画规格;实心图形和品牌图标不会因描边参数变粗。
164
+
165
+ ```vue
166
+ <script setup lang="ts">
167
+ import 'x-next/style.css';
168
+ import { Icon } from 'x-next';
169
+
170
+ </script>
171
+ <template>
172
+ <Icon name="search" :size="28" :stroke-width="1" />
173
+ <Icon name="search" :size="28" :stroke-width="2" />
174
+ <Icon name="search" :size="28" :stroke-width="3" />
175
+ <Icon name="circle-question-mark" :size="28" :stroke-width="1.5" />
176
+ </template>
177
+ ```
178
+
179
+ ### 旋转和加载
180
+
181
+ `loading` 是 X-Next 自带的变长圆弧,自动播放动画;`loader-circle` 是固定开口圆环,配合 `spin` 旋转。两种加载效果分别保留;系统减少动效时均显示静态图形。
182
+
183
+ ```vue
184
+ <script setup lang="ts">
185
+ import 'x-next/style.css';
186
+ import { Icon } from 'x-next';
187
+
188
+ </script>
189
+ <template>
190
+ <Icon name="chevron-right" :rotate="90" />
191
+ <Icon name="chevron-right" :rotate="180" />
192
+ <Icon name="loading" />
193
+ <Icon name="loader-circle" spin />
194
+ <Icon name="loading" :size="22" color="var(--x-color-primary-6)" />
195
+ </template>
196
+ ```
197
+
198
+ ### 图标按钮
199
+
200
+ 可点击图标应由按钮或其他可交互控件承载,并提供可访问名称。纯装饰性图标默认会设置 `aria-hidden="true"`。
201
+
202
+ ```vue
203
+ <script setup lang="ts">
204
+ import 'x-next/style.css';
205
+ import { Button, Icon } from 'x-next';
206
+
207
+ import type { HTMLAttributes } from 'vue';
208
+ const nativeAttrs1 = { "aria-label": "搜索", "title": "搜索" } satisfies HTMLAttributes;
209
+ const nativeAttrs2 = { "aria-label": "下载", "title": "下载" } satisfies HTMLAttributes;
210
+ const nativeAttrs3 = { "aria-label": "删除" } satisfies HTMLAttributes;
211
+ const nativeAttrs4 = { "aria-label": "关闭", "title": "关闭" } satisfies HTMLAttributes;
212
+ </script>
213
+ <template>
214
+ <Button v-bind="nativeAttrs1" shape="circle" >
215
+ <Icon name="search" />
216
+ </Button>
217
+ <Button v-bind="nativeAttrs2" type="outline" shape="circle" >
218
+ <Icon name="download" />
219
+ </Button>
220
+ <Button type="primary">
221
+ <template #icon>
222
+ <Icon name="plus" />
223
+ </template>
224
+ 新建
225
+ </Button>
226
+ <Button v-bind="nativeAttrs3" type="text" status="danger" >
227
+ <template #icon>
228
+ <Icon name="trash" />
229
+ </template>
230
+ 删除
231
+ </Button>
232
+ <Button v-bind="nativeAttrs4" type="text" shape="circle" >
233
+ <Icon name="x" />
234
+ </Button>
235
+ </template>
236
+ ```
237
+
238
+ ### 自定义图标
239
+
240
+ `addIcon` 支持本地可信 SVG 字符串。`?raw` 是 Vite 的文件导入语法,表示把 `diamond.svg` 的文件内容作为字符串导入;如果不加 `?raw`,通常拿到的是打包后的图片 URL,不能直接注册成图标。不要把用户输入或远程接口返回的 SVG 直接传入 `addIcon`。
241
+
242
+ ```vue
243
+ <script setup lang="ts">
244
+ import 'x-next/style.css';
245
+ import { Icon } from 'x-next';
246
+ import { addIcon } from 'x-next';
247
+ const diamondSvg = '<svg viewBox="0 0 48 48"><path d="M24 4 44 24 24 44 4 24 4Z" fill="currentColor"/></svg>';
248
+
249
+ addIcon('demo-diamond', diamondSvg);
250
+ </script>
251
+ <template>
252
+ <Icon name="demo-diamond" :size="22" color="var(--x-color-primary-6)" />
253
+ </template>
254
+ ```
255
+
256
+
257
+ 返回 [AI 索引](../index.md)。先查本页与 [本地 API](./icon-api.md);需要更深类型时查 [公开组件导航](../catalog.md),不默认上网查找本包用法。
@@ -0,0 +1,440 @@
1
+ <!-- Generated by pnpm generate:ai-usage. Edit script/ai-usage/content.md and script/ai-usage/. -->
2
+ # Image 完整公开 API
3
+
4
+ 适用版本:x-next@1.14.0;来源指纹:`014984639d816a2c7e25eb22690c586b0b2e8efba6846bec8a4e424db41a09e9`。
5
+
6
+ 从同版本构建的公开声明、运行时 props/emits 和显式 expose 生成。运行时导入始终使用 `x-next`,声明路径仅作定位。插槽类型未细化时,具体槽名与作用域见本地用法示例。
7
+
8
+ ## Image API
9
+
10
+ 公开声明:`dist/components/image/index.d.ts`。 类型中的 undefined 表示可省略;原始 prop 默认值不等于继承配置或服务默认值。
11
+
12
+ ### Props
13
+
14
+ | 名称 | 用途 | 公开类型 | 必填 | 声明默认值 |
15
+ | --- | --- | --- | --- | --- |
16
+ | renderToBody | 预览是否挂载到 body | undefined &#124; false &#124; true | 否 | true |
17
+ | src | 图片地址 | undefined &#124; string | 否 | 未声明 |
18
+ | width | 图片宽度 | undefined &#124; string &#124; number | 否 | 未声明 |
19
+ | height | 图片高度 | undefined &#124; string &#124; number | 否 | 未声明 |
20
+ | title | 标题 | undefined &#124; string | 否 | 未声明 |
21
+ | description | 描述 | undefined &#124; string | 否 | 未声明 |
22
+ | fit | 图片适应方式 | undefined &#124; "fill" &#124; "none" &#124; "contain" &#124; "cover" &#124; "scale-down" | 否 | 未声明 |
23
+ | alt | 图片文字描述 | undefined &#124; string | 否 | 未声明 |
24
+ | hideFooter | 是否隐藏底部信息;传 'never' 时加载错误也显示 footer | undefined &#124; false &#124; true &#124; "never" | 否 | false |
25
+ | footerPosition | 底部信息位置 | undefined &#124; "outer" &#124; "inner" | 否 | "inner" |
26
+ | showLoader | 是否显示加载中效果 | undefined &#124; false &#124; true | 否 | false |
27
+ | preview | 是否开启预览 | undefined &#124; false &#124; true | 否 | true |
28
+ | previewVisible | 预览是否打开 | undefined &#124; false &#124; true | 否 | undefined |
29
+ | defaultPreviewVisible | 默认是否打开预览 | undefined &#124; false &#124; true | 否 | false |
30
+ | previewProps | 预览配置 | undefined &#124; ImagePreviewProps | 否 | 未声明 |
31
+ | footerClass | 底部区域类名 | undefined &#124; string &#124; { [x: string]: any; } &#124; unknown[] | 否 | 未声明 |
32
+
33
+ ### Events
34
+
35
+ | 事件 | 用途 | 监听器签名(即事件参数) |
36
+ | --- | --- | --- |
37
+ | preview-visible-change | 见场景用法与类型 | undefined &#124; (_visible: boolean) => any |
38
+ | update:previewVisible | 预览显隐变化时触发 | undefined &#124; (_visible: boolean) => any |
39
+ | load | 当前图片加载成功 | undefined &#124; (_event: Event) => any |
40
+ | error | 当前图片加载失败 | undefined &#124; (_event: Event) => any |
41
+
42
+ ### Slots
43
+
44
+ | 名称 | 用途 | 公开类型 |
45
+ | --- | --- | --- |
46
+ | error-icon | 自定义错误图标 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
47
+ | error | 自定义错误内容 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
48
+ | loader | 自定义加载内容 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
49
+ | extra | 底部额外内容 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
50
+ | preview-actions | 预览额外操作项 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
51
+
52
+ ### 实例方法
53
+
54
+ 没有检索到显式 expose 或 Options API methods 的公开方法;不把 setup 内部函数当成稳定实例 API。
55
+
56
+ ### 关联类型定义
57
+
58
+ 以下摘自本组件族声明,供查阅嵌套配置;运行时和值类型均以根入口可导出项为准。
59
+
60
+ ```typescript-reference
61
+ interface ImageProps {
62
+ src?: string;
63
+ width?: string | number;
64
+ height?: string | number;
65
+ title?: string;
66
+ description?: string;
67
+ fit?: '' | 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
68
+ alt?: string;
69
+ hideFooter: boolean | 'never';
70
+ footerPosition: 'inner' | 'outer';
71
+ showLoader: boolean;
72
+ preview: boolean;
73
+ previewVisible?: boolean;
74
+ defaultPreviewVisible: boolean;
75
+ previewProps?: Partial<ImagePreviewProps>;
76
+ extra?: Slot;
77
+ error?: Slot;
78
+ loader?: Slot;
79
+ onPreviewVisibleChange?: (visible: boolean) => void;
80
+ onLoad?: (event: Event) => void;
81
+ onError?: (event: Event) => void;
82
+ renderToBody?: boolean;
83
+ footerClass?: string | unknown[] | Record<string, boolean>;
84
+ 'onUpdate:previewVisible'?: (visible: boolean) => void;
85
+ }
86
+
87
+ interface ImagePreviewProps {
88
+ src?: string;
89
+ visible?: boolean;
90
+ defaultVisible?: boolean;
91
+ maskClosable?: boolean;
92
+ closable?: boolean;
93
+ actionsLayout?: string[];
94
+ popupContainer?: HTMLElement | string;
95
+ escToClose?: boolean;
96
+ keyboard?: boolean;
97
+ wheelZoom?: boolean;
98
+ defaultScale?: number;
99
+ zoomRate?: number;
100
+ renderToBody?: boolean;
101
+ 'onUpdate:visible'?: (visible: boolean) => void;
102
+ groupArrowProps?: Record<string, any>;
103
+ onClose?: () => void;
104
+ }
105
+
106
+ interface ImagePreviewGroupProps extends Omit<ImagePreviewProps, 'src' | 'onClose'> {
107
+ srcList?: string[];
108
+ current?: number;
109
+ defaultCurrent: number;
110
+ infinite: boolean;
111
+ onChange?: (index: number) => void;
112
+ onVisibleChange?: (visible: boolean) => void;
113
+ 'onUpdate:current'?: (index: number) => void;
114
+ }
115
+
116
+ interface ActionType {
117
+ key: string;
118
+ name: string;
119
+ content: RenderFunc;
120
+ onClick: () => void;
121
+ disabled?: boolean;
122
+ }
123
+ ```
124
+
125
+
126
+ ## ImagePreview API
127
+
128
+ 公开声明:`dist/components/image/index.d.ts`。 类型中的 undefined 表示可省略;原始 prop 默认值不等于继承配置或服务默认值。
129
+
130
+ ### Props
131
+
132
+ | 名称 | 用途 | 公开类型 | 必填 | 声明默认值 |
133
+ | --- | --- | --- | --- | --- |
134
+ | renderToBody | 是否通过 Teleport 挂载到宿主容器 | undefined &#124; false &#124; true | 否 | true |
135
+ | src | 图片地址 | undefined &#124; string | 否 | 未声明 |
136
+ | visible | 是否显示预览 | undefined &#124; false &#124; true | 否 | undefined |
137
+ | defaultVisible | 默认是否显示预览 | undefined &#124; false &#124; true | 否 | false |
138
+ | maskClosable | 点击遮罩是否关闭 | undefined &#124; false &#124; true | 否 | true |
139
+ | closable | 是否显示关闭按钮 | undefined &#124; false &#124; true | 否 | true |
140
+ | actionsLayout | 操作项布局 | undefined &#124; string[] | 否 | 工厂函数(每个实例初始化;有效值见行为说明) |
141
+ | popupContainer | 弹出层挂载容器 | undefined &#124; string &#124; HTMLElement | 否 | 未声明 |
142
+ | inGroup | 见场景用法与类型 | undefined &#124; false &#124; true | 否 | false |
143
+ | groupArrowProps | 见场景用法与类型 | undefined &#124; { [x: string]: any; } | 否 | {} |
144
+ | escToClose | 是否支持 Esc 关闭 | undefined &#124; false &#124; true | 否 | true |
145
+ | wheelZoom | 是否支持滚轮缩放 | undefined &#124; false &#124; true | 否 | true |
146
+ | keyboard | 是否支持键盘控制 | undefined &#124; false &#124; true | 否 | true |
147
+ | defaultScale | 默认缩放比 | undefined &#124; number | 否 | 1 |
148
+ | zoomRate | 缩放速率 | undefined &#124; number | 否 | 1.1 |
149
+
150
+ ### Events
151
+
152
+ | 事件 | 用途 | 监听器签名(即事件参数) |
153
+ | --- | --- | --- |
154
+ | close | 点击关闭按钮、遮罩或按 Esc 关闭时触发 | undefined &#124; (...args: any[]) => any |
155
+ | update:visible | 预览显隐变化时触发 | undefined &#124; (...args: any[]) => any |
156
+
157
+ ### Slots
158
+
159
+ | 名称 | 用途 | 公开类型 |
160
+ | --- | --- | --- |
161
+ | actions | 自定义额外操作项 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
162
+
163
+ ### 实例方法
164
+
165
+ 没有检索到显式 expose 或 Options API methods 的公开方法;不把 setup 内部函数当成稳定实例 API。
166
+
167
+ ### 关联类型定义
168
+
169
+ 以下摘自本组件族声明,供查阅嵌套配置;运行时和值类型均以根入口可导出项为准。
170
+
171
+ ```typescript-reference
172
+ interface ImageProps {
173
+ src?: string;
174
+ width?: string | number;
175
+ height?: string | number;
176
+ title?: string;
177
+ description?: string;
178
+ fit?: '' | 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
179
+ alt?: string;
180
+ hideFooter: boolean | 'never';
181
+ footerPosition: 'inner' | 'outer';
182
+ showLoader: boolean;
183
+ preview: boolean;
184
+ previewVisible?: boolean;
185
+ defaultPreviewVisible: boolean;
186
+ previewProps?: Partial<ImagePreviewProps>;
187
+ extra?: Slot;
188
+ error?: Slot;
189
+ loader?: Slot;
190
+ onPreviewVisibleChange?: (visible: boolean) => void;
191
+ onLoad?: (event: Event) => void;
192
+ onError?: (event: Event) => void;
193
+ renderToBody?: boolean;
194
+ footerClass?: string | unknown[] | Record<string, boolean>;
195
+ 'onUpdate:previewVisible'?: (visible: boolean) => void;
196
+ }
197
+
198
+ interface ImagePreviewProps {
199
+ src?: string;
200
+ visible?: boolean;
201
+ defaultVisible?: boolean;
202
+ maskClosable?: boolean;
203
+ closable?: boolean;
204
+ actionsLayout?: string[];
205
+ popupContainer?: HTMLElement | string;
206
+ escToClose?: boolean;
207
+ keyboard?: boolean;
208
+ wheelZoom?: boolean;
209
+ defaultScale?: number;
210
+ zoomRate?: number;
211
+ renderToBody?: boolean;
212
+ 'onUpdate:visible'?: (visible: boolean) => void;
213
+ groupArrowProps?: Record<string, any>;
214
+ onClose?: () => void;
215
+ }
216
+
217
+ interface ImagePreviewGroupProps extends Omit<ImagePreviewProps, 'src' | 'onClose'> {
218
+ srcList?: string[];
219
+ current?: number;
220
+ defaultCurrent: number;
221
+ infinite: boolean;
222
+ onChange?: (index: number) => void;
223
+ onVisibleChange?: (visible: boolean) => void;
224
+ 'onUpdate:current'?: (index: number) => void;
225
+ }
226
+
227
+ interface ActionType {
228
+ key: string;
229
+ name: string;
230
+ content: RenderFunc;
231
+ onClick: () => void;
232
+ disabled?: boolean;
233
+ }
234
+ ```
235
+
236
+
237
+ ## ImagePreviewAction API
238
+
239
+ 公开声明:`dist/components/image/index.d.ts`。 类型中的 undefined 表示可省略;原始 prop 默认值不等于继承配置或服务默认值。
240
+
241
+ ### Props
242
+
243
+ | 名称 | 用途 | 公开类型 | 必填 | 声明默认值 |
244
+ | --- | --- | --- | --- | --- |
245
+ | name | 操作项名称,会用于 tooltip 和可访问标签 | undefined &#124; string | 否 | 未声明 |
246
+ | disabled | 是否禁用 | undefined &#124; false &#124; true | 否 | false(Vue Boolean 转换) |
247
+
248
+ ### Events
249
+
250
+ 未声明组件 emits;原生事件与包装透传按本页用法核实。
251
+
252
+ ### Slots
253
+
254
+ 公开类型未逐项声明插槽;本页场景说明列出实际使用的插槽,不将任意插槽视为已支持。
255
+
256
+ ### 实例方法
257
+
258
+ 没有检索到显式 expose 或 Options API methods 的公开方法;不把 setup 内部函数当成稳定实例 API。
259
+
260
+ ### 关联类型定义
261
+
262
+ 以下摘自本组件族声明,供查阅嵌套配置;运行时和值类型均以根入口可导出项为准。
263
+
264
+ ```typescript-reference
265
+ interface ImageProps {
266
+ src?: string;
267
+ width?: string | number;
268
+ height?: string | number;
269
+ title?: string;
270
+ description?: string;
271
+ fit?: '' | 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
272
+ alt?: string;
273
+ hideFooter: boolean | 'never';
274
+ footerPosition: 'inner' | 'outer';
275
+ showLoader: boolean;
276
+ preview: boolean;
277
+ previewVisible?: boolean;
278
+ defaultPreviewVisible: boolean;
279
+ previewProps?: Partial<ImagePreviewProps>;
280
+ extra?: Slot;
281
+ error?: Slot;
282
+ loader?: Slot;
283
+ onPreviewVisibleChange?: (visible: boolean) => void;
284
+ onLoad?: (event: Event) => void;
285
+ onError?: (event: Event) => void;
286
+ renderToBody?: boolean;
287
+ footerClass?: string | unknown[] | Record<string, boolean>;
288
+ 'onUpdate:previewVisible'?: (visible: boolean) => void;
289
+ }
290
+
291
+ interface ImagePreviewProps {
292
+ src?: string;
293
+ visible?: boolean;
294
+ defaultVisible?: boolean;
295
+ maskClosable?: boolean;
296
+ closable?: boolean;
297
+ actionsLayout?: string[];
298
+ popupContainer?: HTMLElement | string;
299
+ escToClose?: boolean;
300
+ keyboard?: boolean;
301
+ wheelZoom?: boolean;
302
+ defaultScale?: number;
303
+ zoomRate?: number;
304
+ renderToBody?: boolean;
305
+ 'onUpdate:visible'?: (visible: boolean) => void;
306
+ groupArrowProps?: Record<string, any>;
307
+ onClose?: () => void;
308
+ }
309
+
310
+ interface ImagePreviewGroupProps extends Omit<ImagePreviewProps, 'src' | 'onClose'> {
311
+ srcList?: string[];
312
+ current?: number;
313
+ defaultCurrent: number;
314
+ infinite: boolean;
315
+ onChange?: (index: number) => void;
316
+ onVisibleChange?: (visible: boolean) => void;
317
+ 'onUpdate:current'?: (index: number) => void;
318
+ }
319
+
320
+ interface ActionType {
321
+ key: string;
322
+ name: string;
323
+ content: RenderFunc;
324
+ onClick: () => void;
325
+ disabled?: boolean;
326
+ }
327
+ ```
328
+
329
+
330
+ ## ImagePreviewGroup API
331
+
332
+ 公开声明:`dist/components/image/index.d.ts`。 类型中的 undefined 表示可省略;原始 prop 默认值不等于继承配置或服务默认值。
333
+
334
+ ### Props
335
+
336
+ | 名称 | 用途 | 公开类型 | 必填 | 声明默认值 |
337
+ | --- | --- | --- | --- | --- |
338
+ | renderToBody | 是否挂载到 body | undefined &#124; false &#124; true | 否 | true |
339
+ | srcList | 图片列表;设置后不再收集子 Image 的图片信息 | undefined &#124; string[] | 否 | 未声明 |
340
+ | current | 当前图片下标 | undefined &#124; number | 否 | 未声明 |
341
+ | defaultCurrent | 默认图片下标 | undefined &#124; number | 否 | 0 |
342
+ | infinite | 是否无限循环 | undefined &#124; false &#124; true | 否 | false |
343
+ | visible | 是否显示预览 | undefined &#124; false &#124; true | 否 | undefined |
344
+ | defaultVisible | 默认是否显示预览 | undefined &#124; false &#124; true | 否 | false |
345
+ | maskClosable | 点击遮罩是否关闭 | undefined &#124; false &#124; true | 否 | true |
346
+ | closable | 是否显示关闭按钮 | undefined &#124; false &#124; true | 否 | true |
347
+ | actionsLayout | 操作项布局 | undefined &#124; string[] | 否 | 工厂函数(每个实例初始化;有效值见行为说明) |
348
+ | popupContainer | 弹出层挂载容器 | undefined &#124; string &#124; HTMLElement | 否 | 未声明 |
349
+
350
+ ### Events
351
+
352
+ | 事件 | 用途 | 监听器签名(即事件参数) |
353
+ | --- | --- | --- |
354
+ | change | 切换图片时触发 | undefined &#124; (...args: any[]) => any |
355
+ | update:current | 当前图片下标变化时触发 | undefined &#124; (...args: any[]) => any |
356
+ | visible-change | 见场景用法与类型 | undefined &#124; (...args: any[]) => any |
357
+ | update:visible | 预览显隐变化时触发 | undefined &#124; (...args: any[]) => any |
358
+
359
+ ### Slots
360
+
361
+ | 名称 | 用途 | 公开类型 |
362
+ | --- | --- | --- |
363
+ | default | 图片列表内容 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
364
+ | actions | 自定义额外操作项,插槽参数为 { url } | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
365
+
366
+ ### 实例方法
367
+
368
+ 没有检索到显式 expose 或 Options API methods 的公开方法;不把 setup 内部函数当成稳定实例 API。
369
+
370
+ ### 关联类型定义
371
+
372
+ 以下摘自本组件族声明,供查阅嵌套配置;运行时和值类型均以根入口可导出项为准。
373
+
374
+ ```typescript-reference
375
+ interface ImageProps {
376
+ src?: string;
377
+ width?: string | number;
378
+ height?: string | number;
379
+ title?: string;
380
+ description?: string;
381
+ fit?: '' | 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
382
+ alt?: string;
383
+ hideFooter: boolean | 'never';
384
+ footerPosition: 'inner' | 'outer';
385
+ showLoader: boolean;
386
+ preview: boolean;
387
+ previewVisible?: boolean;
388
+ defaultPreviewVisible: boolean;
389
+ previewProps?: Partial<ImagePreviewProps>;
390
+ extra?: Slot;
391
+ error?: Slot;
392
+ loader?: Slot;
393
+ onPreviewVisibleChange?: (visible: boolean) => void;
394
+ onLoad?: (event: Event) => void;
395
+ onError?: (event: Event) => void;
396
+ renderToBody?: boolean;
397
+ footerClass?: string | unknown[] | Record<string, boolean>;
398
+ 'onUpdate:previewVisible'?: (visible: boolean) => void;
399
+ }
400
+
401
+ interface ImagePreviewProps {
402
+ src?: string;
403
+ visible?: boolean;
404
+ defaultVisible?: boolean;
405
+ maskClosable?: boolean;
406
+ closable?: boolean;
407
+ actionsLayout?: string[];
408
+ popupContainer?: HTMLElement | string;
409
+ escToClose?: boolean;
410
+ keyboard?: boolean;
411
+ wheelZoom?: boolean;
412
+ defaultScale?: number;
413
+ zoomRate?: number;
414
+ renderToBody?: boolean;
415
+ 'onUpdate:visible'?: (visible: boolean) => void;
416
+ groupArrowProps?: Record<string, any>;
417
+ onClose?: () => void;
418
+ }
419
+
420
+ interface ImagePreviewGroupProps extends Omit<ImagePreviewProps, 'src' | 'onClose'> {
421
+ srcList?: string[];
422
+ current?: number;
423
+ defaultCurrent: number;
424
+ infinite: boolean;
425
+ onChange?: (index: number) => void;
426
+ onVisibleChange?: (visible: boolean) => void;
427
+ 'onUpdate:current'?: (index: number) => void;
428
+ }
429
+
430
+ interface ActionType {
431
+ key: string;
432
+ name: string;
433
+ content: RenderFunc;
434
+ onClick: () => void;
435
+ disabled?: boolean;
436
+ }
437
+ ```
438
+
439
+
440
+ 返回 [Image 用法](./image.md)。