[英]image doesn't render when using next.js Image tag
I have an image located in the public/img directory.我有一个位于public/img目录中的图像。 I want to render it using the next.js built-in
<Image/>
tag.我想使用 next.js 内置
<Image/>
标签来渲染它。
here is the code I have written:这是我写的代码:
<Image
onClick={hideModal}
alt="close_button"
src="/img/close_button.png"
width="20px"
height="20px"
/>
but nothing is shown on the page (not even the alt-text).但页面上没有显示任何内容(甚至没有替代文本)。
the thing is when I use the <img/>
tag, it works as expected but with the <Image/>
, it doesn't问题是当我使用
<img/>
标签时,它按预期工作,但使用<Image/>
时,它不会
doest need add img folder just add /close-button.png不需要添加 img 文件夹只需添加 /close-button.png
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.