[英]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.