فهرست منبع

优化时间组件

songxy 1 سال پیش
والد
کامیت
b72a4d5cdb
1فایلهای تغییر یافته به همراه4 افزوده شده و 1 حذف شده
  1. 4 1
      client_h5/src/components/dateTimeRange.vue

+ 4 - 1
client_h5/src/components/dateTimeRange.vue

@@ -38,18 +38,21 @@ const currentDay: number = new Date().getDate();
 const selectYear = ref<string>(currentYear.toString());
 const selectMonth = ref<string>(currentMonth.toString());
 
-const currentDateTime = ref<string>()
+const currentDateTime = ref<string>('')
 const selectDateTime = ref<string[]>([])
 if (props.modelValue) {
   selectDateTime.value = formatDateTimeArr(props.modelValue);
+  currentDateTime.value = props.modelValue
 } else {
   selectDateTime.value = [currentYear.toString(), fillZero(currentMonth), fillZero(currentDay)]
 }
 watch(() => props.modelValue, (newVal) => {
   if(!newVal){
+    currentDateTime.value = ''
     selectDateTime.value = [currentYear.toString(), fillZero(currentMonth), fillZero(currentDay)]
     return;
   }
+  currentDateTime.value = newVal
   const newArr = formatDateTimeArr(newVal);
   selectDateTime.value = newArr
   selectYear.value = newArr[0].toString()