Skip to content

Commit 06c0976

Browse files
author
昔梦
committed
fix:修复form-render searchForm外部控制collapsed不生效问题
1 parent 75ecfcc commit 06c0976

File tree

1 file changed

+21
-0
lines changed
  • packages/form-render/src/derivative/SearchForm

1 file changed

+21
-0
lines changed

packages/form-render/src/derivative/SearchForm/index.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,27 @@ const SearchForm: <RecordType extends object = any>(props: SearchProps<RecordTyp
135135
}
136136
}, [column]);
137137

138+
useUpdateEffect(() => {
139+
if (collapsed) {
140+
if ((!isColumn && fieldNum > (column * 2 - 1)) || (isColumn && fieldNum > (column -1))) {
141+
setState({
142+
hasCollapse: true,
143+
isExpand: !defaultCollapsed
144+
});
145+
} else {
146+
setState({
147+
hasCollapse: false,
148+
isExpand: true
149+
});
150+
}
151+
} else {
152+
setState({
153+
hasCollapse: false,
154+
isExpand: true,
155+
});
156+
}
157+
}, [collapsed]);
158+
138159
const initMount = async () => {
139160
if (!searchOnMount) {
140161
return;

0 commit comments

Comments
 (0)