Skip to content

Commit

Permalink
Merge pull request baidu#9550 from wibetter/master
Browse files Browse the repository at this point in the history
fix(amis): InputText 清空操作支持clearValueOnEmpty配置
  • Loading branch information
wibetter committed Jan 29, 2024
2 parents a06a2e4 + 15bad83 commit 60d7f4d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/amis/src/renderers/Form/InputText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 60d7f4d

Please sign in to comment.