diff --git a/packages/vant/src/cascader/Cascader.tsx b/packages/vant/src/cascader/Cascader.tsx index 7e61d423b..deda430eb 100644 --- a/packages/vant/src/cascader/Cascader.tsx +++ b/packages/vant/src/cascader/Cascader.tsx @@ -259,10 +259,9 @@ export default defineComponent({ unselected: !selected, })} > - {slots['options-top'] - ? slots['options-top']({ tabIndex: activeTab.value }) - : null} + {slots['options-top']?.({ tabIndex })} {renderOptions(options, selected, tabIndex)} + {slots['options-bottom']?.({ tabIndex })} ); }; diff --git a/packages/vant/src/cascader/README.md b/packages/vant/src/cascader/README.md index 6f1c66cd0..cde09899b 100644 --- a/packages/vant/src/cascader/README.md +++ b/packages/vant/src/cascader/README.md @@ -282,7 +282,8 @@ export default { | --- | --- | --- | | title | Custom title | - | | option `v3.1.4` | Custom option text | _{ option: Option, selected: boolean }_ | -| options-top `v3.2.7` | Custom the content above options | _{ tabIndex: number }_ | +| options-top `v3.2.7` | Custom the content above the options | _{ tabIndex: number }_ | +| options-bottom `v3.2.8` | Custom the content below the options | _{ tabIndex: number }_ | ### Types diff --git a/packages/vant/src/cascader/README.zh-CN.md b/packages/vant/src/cascader/README.zh-CN.md index e1353bf5e..78fac0a94 100644 --- a/packages/vant/src/cascader/README.zh-CN.md +++ b/packages/vant/src/cascader/README.zh-CN.md @@ -295,6 +295,7 @@ export default { | title | 自定义顶部标题 | - | | option `v3.1.4` | 自定义选项文字 | _{ option: Option, selected: boolean }_ | | options-top `v3.2.7` | 自定义选项上方的内容 | _{ tabIndex: number }_ | +| options-bottom `v3.2.8` | 自定义选项下方的内容 | _{ tabIndex: number }_ | ### 类型定义 diff --git a/packages/vant/src/cascader/test/__snapshots__/index.spec.ts.snap b/packages/vant/src/cascader/test/__snapshots__/index.spec.ts.snap index c1459b0ac..aa247e4b3 100644 --- a/packages/vant/src/cascader/test/__snapshots__/index.spec.ts.snap +++ b/packages/vant/src/cascader/test/__snapshots__/index.spec.ts.snap @@ -1,8 +1,19 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[` should allow more custom content 1`] = ` +exports[`should change close icon when using close-icon prop 1`] = ` + + +`; + +exports[`should render option slot correctly 1`] = ` +