From 83dcbe6f5fd7e777451f3de02eb91748e66b20bb Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 13 Nov 2022 09:22:48 +0800 Subject: [PATCH] fix(DatePicker): only throw error in development (#11248) --- packages/vant/src/date-picker/DatePicker.tsx | 9 ++++++--- packages/vant/src/time-picker/TimePicker.tsx | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/vant/src/date-picker/DatePicker.tsx b/packages/vant/src/date-picker/DatePicker.tsx index f0c0256cc..9bebb67bf 100644 --- a/packages/vant/src/date-picker/DatePicker.tsx +++ b/packages/vant/src/date-picker/DatePicker.tsx @@ -128,9 +128,12 @@ export default defineComponent({ case 'day': return genDayOptions(); default: - throw new Error( - `[Vant] DatePicker: unsupported columns type: ${type}` - ); + if (process.env.NODE_ENV !== 'production') { + throw new Error( + `[Vant] DatePicker: unsupported columns type: ${type}` + ); + } + return []; } }) ); diff --git a/packages/vant/src/time-picker/TimePicker.tsx b/packages/vant/src/time-picker/TimePicker.tsx index d754c7a62..690739dda 100644 --- a/packages/vant/src/time-picker/TimePicker.tsx +++ b/packages/vant/src/time-picker/TimePicker.tsx @@ -83,9 +83,12 @@ export default defineComponent({ filter ); default: - throw new Error( - `[Vant] DatePicker: unsupported columns type: ${type}` - ); + if (process.env.NODE_ENV !== 'production') { + throw new Error( + `[Vant] DatePicker: unsupported columns type: ${type}` + ); + } + return []; } }) );