修复text autoComplete 中选中后显示value而不是label的问题

This commit is contained in:
catchonme 2019-06-03 16:49:59 +08:00
parent fec869552b
commit 8edecde1ed
1 changed files with 3 additions and 1 deletions

View File

@ -340,9 +340,11 @@ export default class TextControl extends React.PureComponent<TextProps, TextStat
} = this.props;
if (autoComplete && formItem) {
const length = formItem.selectedOptions.length;
const lastSelectLabel = length ? formItem.selectedOptions[length - 1].label : '';
formItem.loadOptions(autoComplete, {
...data,
term: this.state.inputValue || formItem.lastSelectValue
term: this.state.inputValue || lastSelectLabel
});
}
}