Skip to content

Commit

Permalink
fix(cascader): 受控状态下 value 变化时同步组件选中状态 (jdf2e#2591)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangminggeek authored Sep 13, 2024
1 parent a2d7786 commit 7f72a1b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/packages/cascader/cascader.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ const InternalCascader: ForwardRefRenderFunction<
initData()
}, [options, format])

useEffect(() => {
syncValue()
}, [value])

const initData = async () => {
// 初始化开始处理数据
state.lazyLoadMap.clear()
Expand Down
4 changes: 4 additions & 0 deletions src/packages/cascader/cascader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ const InternalCascader: ForwardRefRenderFunction<
initData()
}, [options, format])

useEffect(() => {
syncValue()
}, [value])

const initData = async () => {
// 初始化开始处理数据
state.lazyLoadMap.clear()
Expand Down

0 comments on commit 7f72a1b

Please sign in to comment.