Skip to content

Commit 08bbc84

Browse files
committed
fix(Calendar): 解决onChange死循环
1 parent af86363 commit 08bbc84

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/core/src/Calendar/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ const Calendar = (props: CalendarProps) => {
7979
setLastData(toMonths[0]);
8080
setDayData(toMonths[1]);
8181
setNextData(toMonths[2]);
82-
const date = currentYear + '-' + (currentMonth + 1) + '-' + currentDays;
83-
onChange?.(date);
82+
// const date = currentYear + '-' + (currentMonth + 1) + '-' + currentDays;
83+
// onChange?.(date);
8484
}, [currentYear, currentMonth, currentDays]);
8585

8686
/**
@@ -207,6 +207,7 @@ const Calendar = (props: CalendarProps) => {
207207
setCurrentDays(day.monthDays);
208208
getCurrentMonth('next');
209209
}
210+
onChange?.(day.date || '');
210211
};
211212
const getCurrentYear = (type: string) => {
212213
if (type === 'last') {

0 commit comments

Comments
 (0)