如何为下一个js图像添加边框半径?

Sar*_*ami 20 next.js

当我将 objectFit="cover" 添加到图像时,我的 Next.js 图像组件出现问题,我的边框半径消失了。有人可以帮忙吗?

小智 51

overflow: hidden在包裹图像的 div 上使用:

<div style={{borderRadius: '5px', overflow: 'hidden'}}>
  <Image src="..." layout="fill" objectFit="cover" />
</div>
Run Code Online (Sandbox Code Playgroud)