diff --git a/packages/vant/src/address-list/AddressList.tsx b/packages/vant/src/address-list/AddressList.tsx index 907e63c5d..17eb0e121 100644 --- a/packages/vant/src/address-list/AddressList.tsx +++ b/packages/vant/src/address-list/AddressList.tsx @@ -44,16 +44,13 @@ export default defineComponent({ index: number, disabled?: boolean ) => { - const onEdit = () => { - const name = disabled ? 'edit-disabled' : 'edit'; - emit(name, item, index); - }; + const onEdit = () => + emit(disabled ? 'edit-disabled' : 'edit', item, index); const onClick = () => emit('click-item', item, index); const onSelect = () => { - const name = disabled ? 'select-disabled' : 'select'; - emit(name, item, index); + emit(disabled ? 'select-disabled' : 'select', item, index); if (!disabled) { emit('update:modelValue', item.id); diff --git a/packages/vant/src/steps/README.md b/packages/vant/src/steps/README.md index d894d9a29..13b43fbef 100644 --- a/packages/vant/src/steps/README.md +++ b/packages/vant/src/steps/README.md @@ -89,10 +89,11 @@ export default { ### Step Slots | Name | Description | -| -------------------- | -------------------- | -------- | --- | +| -------------------- | -------------------- | +| default | Step content | | active-icon | Custom active icon | | inactive-icon | Custom inactive icon | -| finish-icon `v3.0.7` | Custom finish icon | _string_ | - | +| finish-icon `v3.0.7` | Custom finish icon | ### Steps Events @@ -100,6 +101,14 @@ export default { | --- | --- | --- | | click-step | Emitted when a step's title or icon is clicked | _index: number_ | +### Types + +The component exports the following type definitions: + +```ts +import type { StepsDirection } from 'vant'; +``` + ## Theming ### CSS Variables diff --git a/packages/vant/src/steps/README.zh-CN.md b/packages/vant/src/steps/README.zh-CN.md index c5fded781..3acdfacc8 100644 --- a/packages/vant/src/steps/README.zh-CN.md +++ b/packages/vant/src/steps/README.zh-CN.md @@ -95,10 +95,11 @@ export default { ### Step Slots | 名称 | 说明 | -| --- | --- | --- | --- | +| --- | --- | +| default | 步骤内容 | | active-icon | 自定义激活状态图标 | | inactive-icon | 自定义未激活状态图标 | -| finish-icon `v3.0.7` | 自定义已完成步骤对应的底部图标,优先级高于 `inactive-icon` | _string_ | - | +| finish-icon `v3.0.7` | 自定义已完成步骤对应的底部图标,优先级高于 `inactive-icon` | ### Steps Events @@ -106,6 +107,14 @@ export default { | ---------- | -------------------------- | --------------- | | click-step | 点击步骤的标题或图标时触发 | _index: number_ | +### 类型定义 + +组件导出以下类型定义: + +```ts +import type { StepsDirection } from 'vant'; +``` + ## 主题定制 ### 样式变量 diff --git a/packages/vant/src/steps/index.ts b/packages/vant/src/steps/index.ts index 375b6e217..182234158 100644 --- a/packages/vant/src/steps/index.ts +++ b/packages/vant/src/steps/index.ts @@ -1,5 +1,6 @@ import { withInstall } from '../utils'; -import _Steps from './Steps'; +import _Steps, { StepsDirection } from './Steps'; export const Steps = withInstall(_Steps); export default Steps; +export type { StepsDirection };