Skip to content

Commit

Permalink
fix: 修复日历进行快捷选择日期时 点击确认获取的是上一次的日期 (#2436)
Browse files Browse the repository at this point in the history
  • Loading branch information
yangqianlu authored Jul 22, 2024
1 parent 15befb0 commit 08a9af5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/packages/calendaritem/calendaritem.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -480,12 +480,14 @@ export const CalendarItem = React.forwardRef<
monthsData.splice(0)
initData()
}

useEffect(() => {
setCurrentDate(resetDefaultValue() || [])
popup && resetRender()
}, [defaultValue])

useEffect(() => {
popup && resetRender()
}, [currentDate])

// 暴露出的API
const scrollToDate = (date: string) => {
if (Utils.compareDate(date, propStartDate)) {
Expand Down
5 changes: 4 additions & 1 deletion src/packages/calendaritem/calendaritem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -483,9 +483,12 @@ export const CalendarItem = React.forwardRef<

useEffect(() => {
setCurrentDate(resetDefaultValue() || [])
popup && resetRender()
}, [defaultValue])

useEffect(() => {
popup && resetRender()
}, [currentDate])

// 暴露出的API
const scrollToDate = (date: string) => {
if (Utils.compareDate(date, propStartDate)) {
Expand Down

0 comments on commit 08a9af5

Please sign in to comment.