fix: 修复选项类控件 placeholder 没有被翻译的问题 (#5336)

This commit is contained in:
liaoxuezhi 2022-09-08 21:19:31 +08:00 committed by RUNZE LU
parent b0fb1f402b
commit 00805c8d6c
2 changed files with 9 additions and 2 deletions

View File

@ -1271,7 +1271,8 @@ export function registerOptionsControl(config: OptionsConfig) {
pathSeparator,
delimiter = ',',
labelField = 'label',
valueField = 'value'
valueField = 'value',
translate: __
} = this.props;
const {nodePathArray, nodeValueArray} = normalizeNodePath(
@ -1286,6 +1287,7 @@ export function registerOptionsControl(config: OptionsConfig) {
return (
<Control
{...this.props}
placeholder={__(this.props.placeholder)}
ref={this.inputRef}
options={formItem ? formItem.filteredOptions : []}
onToggle={this.handleToggle}

View File

@ -49,7 +49,12 @@ export class BaseSelection<
S = any
> extends React.Component<T, S> {
static itemRender(option: Option, states: ItemRenderStates) {
return <span>{option.label}</span>;
return (
<span>
{option.label}
{option.tip || ''}
</span>
);
}
static defaultProps = {