amis-saas-8684 mapping editor 增加 map类型变动监听

Change-Id: Ie6bad448b43cde8f3b6627e4f3bb970ff627e571
This commit is contained in:
jinye 2022-12-22 15:22:47 +08:00
parent 08dc068e0e
commit d6054ea62b

View File

@ -50,6 +50,17 @@ export default class MapSourceControl extends React.Component<
};
}
componentDidUpdate(prevProps: Readonly<MapSourceControlProps>, prevState: Readonly<MapSourceControlState>, snapshot?: any): void {
const isArrayOld = Array.isArray(prevProps.data?.map);
const isArrayNew = Array.isArray(this.props.data?.map);
// map 类型改变了
if (isArrayOld !== isArrayNew) {
this.setState({
map: this.props.data?.map
});
}
}
/**
* map字段的统一出口
*/