[英]add React-intl to placeholder IN OBJECT
I have a problem with const inputProps
. 我对
const inputProps
有问题。 I try add a React-intl to react-autosuggest placeholder input, but now, this placeholder is: [Object object]
. 我尝试将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>
);
...
Placeholder is a string, you putted an Object in it. 占位符是一个字符串,您在其中放置了一个对象。 You can write the code like this:
您可以这样编写代码:
import intl from 'react-intl-universal'
...
placeholder: intl.get(messages.inputAccountNumber).d(messages.inputAccountNumber), // <--
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.