Merge pull request #9550 from wibetter/master

fix(amis): InputText 清空操作支持clearValueOnEmpty配置
This commit is contained in:
刘丹 2024-01-29 20:00:56 +08:00 committed by GitHub
commit 60d7f4d942
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -298,7 +298,12 @@ export default class TextControl extends React.PureComponent<
}
async clearValue() {
const {onChange, resetValue, dispatchEvent} = this.props;
const {onChange, dispatchEvent, clearValueOnEmpty} = this.props;
let resetValue = this.props.resetValue;
if (clearValueOnEmpty && resetValue === '') {
resetValue = undefined;
}
const clearEvent = await dispatchEvent(
'clear',