From e2081c8890171ed1596815147e7e6620f3917815 Mon Sep 17 00:00:00 2001 From: ShuGang Zhou Date: Sat, 28 Oct 2023 22:24:27 +0800 Subject: [PATCH] fix(PickerGroup): only filter Comment vnode (#12402) --- packages/vant/src/picker-group/PickerGroup.tsx | 12 ++++++++++-- .../vant/src/picker-group/demo/SelectDateTime.vue | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/vant/src/picker-group/PickerGroup.tsx b/packages/vant/src/picker-group/PickerGroup.tsx index 97ef3a492..74bfac095 100644 --- a/packages/vant/src/picker-group/PickerGroup.tsx +++ b/packages/vant/src/picker-group/PickerGroup.tsx @@ -1,4 +1,9 @@ -import { defineComponent, type InjectionKey, type ExtractPropTypes } from 'vue'; +import { + defineComponent, + Comment, + type InjectionKey, + type ExtractPropTypes, +} from 'vue'; // Utils import { @@ -71,7 +76,10 @@ export default defineComponent({ const onCancel = () => emit('cancel'); return () => { - const childNodes = slots.default?.(); + const childNodes = slots + .default?.() + ?.filter((node) => node.type !== Comment); + const confirmButtonText = showNextButton() ? props.nextStepText : props.confirmButtonText; diff --git a/packages/vant/src/picker-group/demo/SelectDateTime.vue b/packages/vant/src/picker-group/demo/SelectDateTime.vue index 93def66bf..30d27c855 100644 --- a/packages/vant/src/picker-group/demo/SelectDateTime.vue +++ b/packages/vant/src/picker-group/demo/SelectDateTime.vue @@ -39,11 +39,13 @@ const onCancel = () => { @confirm="onConfirm" @cancel="onCancel" > + +