我已经尝试了阳光下的一切,甚至浏览了很多关于堆栈溢出的解决方案,但无法找到解决问题的方法。由于这样或那样的原因,图像本身根本不想显示。其他一切都很好,除了图像。
<section className='profiles'>
{
profiles.map(data => <Person key={data.id} name={data.name} img={data.img} position={data.position} desc={data.desc} comittee={data.comittee} />)
}
</section>
字符串
下面是json文件:
[
{
"id": 0,
"comittee": false,
"img": "require('@img/person1.jpg')",
"desc": "Here's a short description about the person above and what they do and love not to do",
"position": "member",
},
{
"id": 1,
"comittee": false,
"img": "img/person2.jpg",
"desc": "Here's a short description about the person above and what they do and love not to do",
"position": "member",
},
]
型
1条答案
按热度按时间quhf5bfb1#
下面是一个从JSON显示图像的基本示例代码。
字符串
示例:-https://stackblitz.com/edit/react-vunpjf?file=src%2FApp.js