【发布时间】:2022-06-23 14:02:20
【问题描述】:
我使用react-responsive-carousel 显示带有拇指的产品图片库,而我使用一个简单的img HTML 元素显示拇指,但是当我使用下一张图片时拇指消失了,我想知道如何修复这个问题。
<Carousel showThumbs>
{images.map((image) => (
<Box>
<Badge
badgeContent="30%"
color="primary"
anchorOrigin={{
vertical: 'top',
horizontal: 'left',
}}
sx={{
position: 'absolute',
top: '2rem',
left: '2.5rem',
}}
/>
{/* <img src={image.original} alt="ok" /> this word just fine*/}
{/* this does not show up thumbs */}
<Image
src={image.original}
alt="piece"
width={image.originalWidth}
height={image.originalHeight}
/>
</Box>
))}
</Carousel>
【问题讨论】:
-
你能在代码沙盒或任何在线 IDE 中重现相同的内容吗?
-
您可以尝试几件事:确保
originalWidth和originalHeight是正数;尝试指定layoutprop - 它可以是固有的、固定的、填充的、响应式的、原始的;使用开发人员工具的“元素”选项卡比较这两种情况的呈现方式。
标签: reactjs next.js react-responsive-carousel