🐛(component): 修复datePicker初始值为空时无法点击Bug

This commit is contained in:
0o张不歪o0
2022-07-13 12:22:37 +08:00
parent 914b249b65
commit 831274035c
3 changed files with 10 additions and 3 deletions

View File

@@ -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();