Image
Next.js 的 Image 组件扩展了 HTML <img> 元素,实现了自动图片优化。
app/page.js
import Image from 'next/image'
export default function Page() {
return (
<Image
src="/profile.png"
width={500}
height={500}
alt="Picture of the author"
/>
)
}
提示: 如果你使用的是 Next.js 13 之前的版本,请参考 next/legacy/image 文档,因为组件名称有变更。
参考
Props
可用的 props 如下:
| Prop | 示例 |
|---|