Nextjs 的 layout = responsive 替换代码

layout = responsive 已被弃用,如果使用,会提示:

Image with src "/xxx/xxx.png" has legacy prop "layout". Did you forget to run the codemod?

结合 material-ui 的替换代码为:

<Box position={'relative'} width={1100} height={374}>
   <Image src=xxx" alt="xxx" fill></Image>
</Box>

即可实现响应式。

https://stackoverflow.com/questions/68255994/next-image-image-disappears-with-layout-responsive

你可能感兴趣的:(前端,nextjs)