fix: 修复Tree添加元素问题 (#6616)

This commit is contained in:
meerkat 2023-04-14 13:34:23 +08:00 committed by GitHub
parent ad93bb9956
commit 543c85dfdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -612,9 +612,10 @@ export class TreeSelector extends React.Component<
const result = [] as Option[]; const result = [] as Option[];
for (let option of this.state.flattenedOptions) { for (let option of this.state.flattenedOptions) {
result.push(option);
if (option === parent) { if (option === parent) {
result.push({...option, isAdding: true}); result.push({...option, isAdding: true});
} else {
result.push(option);
} }
} }
this.setState({flattenedOptions: result}); this.setState({flattenedOptions: result});