diff --git a/package/component/src/component/datePicker/index.vue b/package/component/src/component/datePicker/index.vue index 6d243cf9..06033d09 100644 --- a/package/component/src/component/datePicker/index.vue +++ b/package/component/src/component/datePicker/index.vue @@ -232,7 +232,13 @@ watch( ); onMounted(() => { - currentDay.value = new Date(props.modelValue).getTime(); + currentDay.value = props.modelValue ? new Date(props.modelValue).getTime() : -1; + if (currentDay.value == -1) { + setTimeout(() => { + now(); + clear(); + }, 0); + } hms.value.hh = dayjs(props.modelValue).hour(); hms.value.mm = dayjs(props.modelValue).minute(); hms.value.ss = dayjs(props.modelValue).second(); diff --git a/package/document-component/src/document/zh-CN/components/datePicker.md b/package/document-component/src/document/zh-CN/components/datePicker.md index 3855c091..4b47c993 100644 --- a/package/document-component/src/document/zh-CN/components/datePicker.md +++ b/package/document-component/src/document/zh-CN/components/datePicker.md @@ -14,7 +14,7 @@ ::: demo