diff --git a/packages/vant/src/swipe/README.md b/packages/vant/src/swipe/README.md index 4b93268af..54076e953 100644 --- a/packages/vant/src/swipe/README.md +++ b/packages/vant/src/swipe/README.md @@ -206,10 +206,10 @@ swipeRef.value?.next(); ### Swipe Slots -| Name | Description | SlotProps | -| ------------------- | ---------------- | -------------------- | -| default | Content | - | -| indicator `v3.0.16` | Custom indicator | _{ active: number }_ | +| Name | Description | SlotProps | +| ------------------ | ---------------- | ----------------------------------- | +| default | Content | - | +| indicator `v3.3.8` | Custom indicator | _{ active: number, total: number }_ | ## Theming diff --git a/packages/vant/src/swipe/README.zh-CN.md b/packages/vant/src/swipe/README.zh-CN.md index 43abd9e4c..98636d516 100644 --- a/packages/vant/src/swipe/README.zh-CN.md +++ b/packages/vant/src/swipe/README.zh-CN.md @@ -214,10 +214,10 @@ swipeRef.value?.next(); ### Swipe Slots -| 名称 | 说明 | 参数 | -| ------------------- | ------------ | -------------------- | -| default | 轮播内容 | - | -| indicator `v3.0.16` | 自定义指示器 | _{ active: number }_ | +| 名称 | 说明 | 参数 | +| ------------------ | ------------ | ----------------------------------- | +| default | 轮播内容 | - | +| indicator `v3.3.8` | 自定义指示器 | _{ active: number, total: number }_ | ## 主题定制 diff --git a/packages/vant/src/swipe/Swipe.tsx b/packages/vant/src/swipe/Swipe.tsx index 3fd156f9d..564fd277a 100644 --- a/packages/vant/src/swipe/Swipe.tsx +++ b/packages/vant/src/swipe/Swipe.tsx @@ -384,6 +384,7 @@ export default defineComponent({ if (slots.indicator) { return slots.indicator({ active: activeIndicator.value, + total: count.value, }); } if (props.showIndicators && count.value > 1) { diff --git a/packages/vant/src/swipe/test/__snapshots__/index.spec.js.snap b/packages/vant/src/swipe/test/__snapshots__/index.spec.js.snap index 729711266..e09105ee3 100644 --- a/packages/vant/src/swipe/test/__snapshots__/index.spec.js.snap +++ b/packages/vant/src/swipe/test/__snapshots__/index.spec.js.snap @@ -76,6 +76,28 @@ exports[`should render dynamic SwipeItem correctly 2`] = ` `; +exports[`should render indicator slot correctly 1`] = ` +