input-text组件的placeholder属性支持表达式 #7426 判断空值逻辑中也执行filter表达式

This commit is contained in:
殷亮辉 2023-07-11 06:57:30 +00:00
parent 76904e556b
commit dbef91b952

View File

@ -734,6 +734,8 @@ export default class TextControl extends React.PureComponent<
});
}
const filteredPlaceholder = filter(placeholder, data);
return (
<div
className={cx(
@ -750,12 +752,12 @@ export default class TextControl extends React.PureComponent<
onClick={this.handleClick}
>
<>
{placeholder &&
{filteredPlaceholder &&
!selectedOptions.length &&
!this.state.inputValue &&
!this.state.isFocused ? (
<div className={cx('TextControl-placeholder')}>
{filter(placeholder, data)}
{filteredPlaceholder}
</div>
) : null}