This commit is contained in:
rickcole 2020-09-21 10:34:53 +08:00
commit b2ad56d004

View File

@ -131,16 +131,21 @@ export class Transfer extends React.Component<TransferProps, TransferState> {
@autobind @autobind
handleSearch(text: string) { handleSearch(text: string) {
this.setState( // text 有值的时候,走搜索否则直接走 handleSeachCancel ,等同于右侧的 clear 按钮
{ if (text) {
inputValue: text this.setState(
}, {
() => { inputValue: text
// 如果有取消搜索,先取消掉。 },
this.cancelSearch && this.cancelSearch(); () => {
this.lazySearch(text); // 如果有取消搜索,先取消掉。
} this.cancelSearch && this.cancelSearch();
); this.lazySearch(text);
}
);
} else {
this.handleSeachCancel();
}
} }
@autobind @autobind