Skip to content

Commit

Permalink
feat(PickerGroup): add new prop showToolbar (#12839)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReinoFu authored Apr 30, 2024
1 parent 01183e1 commit c25ebf7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
20 changes: 12 additions & 8 deletions packages/vant/src/picker-group/PickerGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
makeArrayProp,
makeNumericProp,
createNamespace,
truthProp,
} from '../utils';

// Composables
Expand All @@ -40,6 +41,7 @@ export const pickerGroupProps = extend(
tabs: makeArrayProp<string>(),
activeTab: makeNumericProp(0),
nextStepText: String,
showToolbar: truthProp,
},
pickerToolbarProps,
);
Expand Down Expand Up @@ -100,14 +102,16 @@ export default defineComponent({

return (
<div class={bem()}>
<Toolbar
v-slots={pick(slots, pickerToolbarSlots)}
title={props.title}
cancelButtonText={props.cancelButtonText}
confirmButtonText={confirmButtonText}
onConfirm={onConfirm}
onCancel={onCancel}
/>
{props.showToolbar ? (
<Toolbar
v-slots={pick(slots, pickerToolbarSlots)}
title={props.title}
cancelButtonText={props.cancelButtonText}
confirmButtonText={confirmButtonText}
onConfirm={onConfirm}
onCancel={onCancel}
/>
) : null}
<Tabs
v-model:active={activeTab.value}
class={bem('tabs')}
Expand Down
1 change: 1 addition & 0 deletions packages/vant/src/picker-group/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ export default {
| v-model:active-tab `v4.3.2` | Set index of active tab | _number \| string_ | `0` |
| tabs | Titles of tabs | _string[]_ | `[]` |
| title | Toolbar title | _string_ | `''` |
| show-toolbar | Whether to show toolbar | _boolean_ | `true` |
| next-step-text `v4.0.8` | Text of next step button | _string_ | `''` |
| confirm-button-text | Text of confirm button | _string_ | `Confirm` |
| cancel-button-text | Text of cancel button | _string_ | `Cancel` |
Expand Down
1 change: 1 addition & 0 deletions packages/vant/src/picker-group/README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ export default {
| v-model:active-tab `v4.3.2` | 设置当前选中的标签 | _number \| string_ | `0` |
| tabs | 设置标签页的标题 | _string[]_ | `[]` |
| title | 顶部栏标题 | _string_ | `''` |
| show-toolbar | 是否显示顶部栏 | _boolean_ | `true` |
| next-step-text `v4.0.8` | 下一步按钮的文字 | _string_ | `''` |
| confirm-button-text | 确认按钮的文字 | _string_ | `确认` |
| cancel-button-text | 取消按钮的文字 | _string_ | `取消` |
Expand Down

0 comments on commit c25ebf7

Please sign in to comment.