Bläddra i källkod

优化dateTimeRange

songxy 1 år sedan
förälder
incheckning
cc1c887f03
1 ändrade filer med 3 tillägg och 2 borttagningar
  1. 3 2
      client_h5/src/components/dateTimeRange.vue

+ 3 - 2
client_h5/src/components/dateTimeRange.vue

@@ -40,16 +40,17 @@ const selectMonth = ref<string>(currentMonth.toString());
 
 const currentDateTime = ref<string>('')
 const selectDateTime = ref<string[]>([])
+const defaultDateTime: string[] = [currentYear.toString(), fillZero(currentMonth), fillZero(currentDay), '00', '00']
 if (props.modelValue) {
   selectDateTime.value = formatDateTimeArr(props.modelValue);
   currentDateTime.value = props.modelValue
 } else {
-  selectDateTime.value = [currentYear.toString(), fillZero(currentMonth), fillZero(currentDay)]
+  selectDateTime.value = defaultDateTime
 }
 watch(() => props.modelValue, (newVal) => {
   if(!newVal){
     currentDateTime.value = ''
-    selectDateTime.value = [currentYear.toString(), fillZero(currentMonth), fillZero(currentDay)]
+    selectDateTime.value = defaultDateTime
     return;
   }
   currentDateTime.value = newVal