[英]React, Having trouble with printing out local image file wrapped by array
I have trouble with print out image within array.我无法在数组中打印出图像。
Here is my dummy data.这是我的虚拟数据。
const dummyData = [
{
thumbnail: '../assets/img/listdummy1.png',
platform: "Steam",
name: "Red Dead Redemption 2",
tags: ["FPS", "RPG"],
originalPrice: 30000,
discountPrice: 15000,
cut: 50,
link:"https://store.steampowered.com/app/1174180/Red_Dead_Redemption_2/",
}
]
I want to print out thumbnail image by map function.我想通过 map function 打印出缩略图。
{props.results.map((item) => (
<SearchItem
key={item.name}
thumbnail={item.thumbnail}
platform={item.platform}
name={item.name}
tags={item.tags}
originalPrice={item.originalPrice}
discountPrice={item.discountPrice}
cut={item.cut}
link={item.link}
/>
))}
just like this.像这样。
and here is my print out code.这是我的打印代码。
<td className={styles.SearchItemThumbnail}>
<img src={props.thumbnail} alt="Loading..." />
</td>
still, the results came out alt (Loading...message).仍然,结果出来了 alt (正在加载...消息)。 Image files are inside of local assets directory and I don't think there is no kind of miswritting with image route.
图像文件位于本地资产目录中,我认为图像路径没有任何错误。
is there any thing wrong about my code?我的代码有什么问题吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.