![](/img/trans.png)
[英]Next.js 13 next.config.js "port" attribute for remotePatterns doesn't work for Image component
[英]image doesn't render when using next.js Image tag
我有一個位於public/img目錄中的圖像。 我想使用 next.js 內置<Image/>
標簽來渲染它。
這是我寫的代碼:
<Image
onClick={hideModal}
alt="close_button"
src="/img/close_button.png"
width="20px"
height="20px"
/>
但頁面上沒有顯示任何內容(甚至沒有替代文本)。
問題是當我使用<img/>
標簽時,它按預期工作,但使用<Image/>
時,它不會
不需要添加 img 文件夾只需添加 /close-button.png
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.