🐛(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(() => { 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.hh = dayjs(props.modelValue).hour();
hms.value.mm = dayjs(props.modelValue).minute(); hms.value.mm = dayjs(props.modelValue).minute();
hms.value.ss = dayjs(props.modelValue).second(); hms.value.ss = dayjs(props.modelValue).second();

View File

@ -14,7 +14,7 @@
::: demo ::: demo
<template> <template>
<lay-date-picker v-model="endTime"></lay-date-picker> <lay-date-picker v-model="endTime" placeholder="click me"></lay-date-picker>
</template> </template>
<script> <script>
@ -23,7 +23,7 @@ import { ref } from 'vue'
export default { export default {
setup() { setup() {
const endTime = ref("2022-03-14 17:35:00"); const endTime = ref("");
return { return {
endTime endTime

View File

@ -18,6 +18,7 @@
<ul> <ul>
<li><span style="color:#FF5722">[破坏性更新]</span> 统一checkbox与radio属性语义 两个组件受到影响 label代表显示值value代表绑定值。 by @SmallWai</li> <li><span style="color:#FF5722">[破坏性更新]</span> 统一checkbox与radio属性语义 两个组件受到影响 label代表显示值value代表绑定值。 by @SmallWai</li>
<li>[修复] page 组件 外部更改v-model视图不刷新问题。 by @SmallWai</li> <li>[修复] page 组件 外部更改v-model视图不刷新问题。 by @SmallWai</li>
<li>[修复] datePicker 组件 初始值为空时无法点击Bug。 by @SmallWai</li>
<li>[修复] datePicker 组件 启用simple属性后无法弹出问题。 by @SmallWai</li> <li>[修复] datePicker 组件 启用simple属性后无法弹出问题。 by @SmallWai</li>
<li>[修复] datePicker 组件 上一次更新带来的Bug。 by @SmallWai</li> <li>[修复] datePicker 组件 上一次更新带来的Bug。 by @SmallWai</li>
<li>[优化] radio 组件 动画效果。 by @SmallWai</li> <li>[优化] radio 组件 动画效果。 by @SmallWai</li>