diff --git a/components/calendar/demo/customize-header.vue b/components/calendar/demo/customize-header.vue index a0579eb5e..5cae0c869 100644 --- a/components/calendar/demo/customize-header.vue +++ b/components/calendar/demo/customize-header.vue @@ -57,7 +57,7 @@ Customize Calendar header content. :value="String(current.month())" @change=" selectedMonth => { - onChange(current.month(parseInt(selectedMonth, 10))); + onChange(current.month(parseInt(String(selectedMonth), 10))); } " > diff --git a/components/calendar/generateCalendar.tsx b/components/calendar/generateCalendar.tsx index bd71a8d7e..991911ecf 100644 --- a/components/calendar/generateCalendar.tsx +++ b/components/calendar/generateCalendar.tsx @@ -127,7 +127,7 @@ function generateCalendar< ? (generateConfig.toDate(props.value, props.valueFormat) as DateType) : (props.value as DateType); } - return null; + return (props.value === '' ? undefined : props.value) as DateType; }); const defaultValue = computed(() => { if (props.defaultValue) { @@ -135,7 +135,7 @@ function generateCalendar< ? (generateConfig.toDate(props.defaultValue, props.valueFormat) as DateType) : (props.defaultValue as DateType); } - return null; + return (props.defaultValue === '' ? undefined : props.defaultValue) as DateType; }); // Value diff --git a/components/date-picker/generatePicker/generateSinglePicker.tsx b/components/date-picker/generatePicker/generateSinglePicker.tsx index c23eb0840..db60742db 100644 --- a/components/date-picker/generatePicker/generateSinglePicker.tsx +++ b/components/date-picker/generatePicker/generateSinglePicker.tsx @@ -119,7 +119,7 @@ export default function generateSinglePicker( ? generateConfig.toDate(props.value as string | DateType, props.valueFormat) : props.value; } - return null; + return (props.value === '' ? undefined : props.value) as DateType; }); const defaultValue = computed(() => { if (props.defaultValue) { @@ -127,7 +127,7 @@ export default function generateSinglePicker( ? generateConfig.toDate(props.defaultValue as string | DateType, props.valueFormat) : props.defaultValue; } - return null; + return (props.defaultValue === '' ? undefined : props.defaultValue) as DateType; }); const defaultPickerValue = computed(() => { if (props.defaultPickerValue) { @@ -138,7 +138,9 @@ export default function generateSinglePicker( ) : props.defaultPickerValue; } - return null; + return ( + props.defaultPickerValue === '' ? undefined : props.defaultPickerValue + ) as DateType; }); return () => { diff --git a/components/input/__tests__/__snapshots__/demo.test.js.snap b/components/input/__tests__/__snapshots__/demo.test.js.snap index f8b3bc548..373eb7ed1 100644 --- a/components/input/__tests__/__snapshots__/demo.test.js.snap +++ b/components/input/__tests__/__snapshots__/demo.test.js.snap @@ -33,8 +33,8 @@ exports[`renders ./components/input/demo/allow-clear.vue correctly 1`] = ` `; exports[`renders ./components/input/demo/autosize-textarea.vue correctly 1`] = ` -
-
+
+
`; diff --git a/components/input/__tests__/demo.test.js b/components/input/__tests__/demo.test.js index 28e21b7a5..d4b729eb0 100644 --- a/components/input/__tests__/demo.test.js +++ b/components/input/__tests__/demo.test.js @@ -1,3 +1,3 @@ import demoTest from '../../../tests/shared/demoTest'; -demoTest('input'); +demoTest('input', { skip: ['autosize-textarea'] });