From ed58e0246ff52a993720431dcf584b018c53dec1 Mon Sep 17 00:00:00 2001 From: neverland Date: Sat, 27 Jan 2024 17:06:24 +0800 Subject: [PATCH] feat(Picker): allow to hidden to toolbar buttons (#12599) --- packages/vant/src/picker/PickerToolbar.tsx | 14 ++++++++++++-- packages/vant/src/picker/README.md | 4 ++-- packages/vant/src/picker/README.zh-CN.md | 4 ++-- packages/vant/src/picker/test/index.spec.tsx | 12 ++++++++++++ 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/packages/vant/src/picker/PickerToolbar.tsx b/packages/vant/src/picker/PickerToolbar.tsx index a2ce916f8..9a1749f05 100644 --- a/packages/vant/src/picker/PickerToolbar.tsx +++ b/packages/vant/src/picker/PickerToolbar.tsx @@ -39,7 +39,12 @@ export default defineComponent({ const onConfirm = () => emit('confirm'); const renderCancel = () => { - const text = props.cancelButtonText || t('cancel'); + const text = props.cancelButtonText ?? t('cancel'); + + if (!slots.cancel && !text) { + return; + } + return (