fix: datepicker panels change, close #5488

pull/5502/head
tangjinzhou 3 years ago
parent 531755ebea
commit a7da435079

@ -3,7 +3,7 @@ import type { GenerateConfig } from '../generate';
import { getValue, updateValues } from '../utils/miscUtil'; import { getValue, updateValues } from '../utils/miscUtil';
import { getClosingViewDate, isSameYear, isSameMonth, isSameDecade } from '../utils/dateUtil'; import { getClosingViewDate, isSameYear, isSameMonth, isSameDecade } from '../utils/dateUtil';
import type { Ref } from 'vue'; import type { Ref } from 'vue';
import { watch, computed, ref } from 'vue'; import { watchEffect, computed, ref } from 'vue';
function getStartEndDistance<DateType>( function getStartEndDistance<DateType>(
startDate: DateType, startDate: DateType,
@ -99,14 +99,10 @@ export default function useRangeViewDates<DateType>({
const startViewDate = ref(null); const startViewDate = ref(null);
const endViewDate = ref(null); const endViewDate = ref(null);
watch( watchEffect(() => {
viewDates, startViewDate.value = getViewDate(0);
() => { endViewDate.value = getViewDate(1);
startViewDate.value = getViewDate(0); });
endViewDate.value = getViewDate(1);
},
{ immediate: true },
);
function setViewDate(viewDate: DateType | null, index: 0 | 1) { function setViewDate(viewDate: DateType | null, index: 0 | 1) {
if (viewDate) { if (viewDate) {

Loading…
Cancel
Save