【发布时间】:2021-11-03 11:49:46
【问题描述】:
我正在尝试在 react 中插入字体很棒的图标,我想将输入的占位符设置为搜索图标
const Search = () => {
return (
<>
<div className="Search">
<form className="Search__form">
<img src="" />
<input
type="text"
placeholder=" Search"
style="font-family:Arial, FontAwesome"
></input>
<button>Search</button>
</form>
</div>
</>
);
};
我收到了这个错误
错误:style 属性需要从样式属性到值的映射,而不是字符串。例如,使用 JSX 时 style={{marginRight: spacing + 'em'}}。
【问题讨论】:
标签: javascript reactjs font-awesome