[英]add React-intl to placeholder IN OBJECT
我对const inputProps
有问题。 我尝试将React-intl添加到react-autosuggest占位符输入,但是现在,该占位符为: [Object object]
。
getStepContent = (step) => {
const inputProps = {
placeholder: <FormattedMessage {...messages.inputAccountNumber} />, // <--
value,
onChange: this.onChange,
maxLength: 26,
};
...
switch (step) {
case 0:
return (
<Fragment>
<Autosuggest
inputProps={inputProps} // <--
/>
</Fragment>
);
...
占位符是一个字符串,您在其中放置了一个对象。 您可以这样编写代码:
import intl from 'react-intl-universal'
...
placeholder: intl.get(messages.inputAccountNumber).d(messages.inputAccountNumber), // <--
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.