相关疑难解决方法(0)

错误:不要使用 <img>。改用“下一个/图像”中的图像。- Next.js 使用 html 标签 <img /> (带样式组件)

我知道在 Next.js 中我们有 Image 组件,但我遇到的问题是我不能将它用作普通的 HTML 标签,如<img />. 我必须给它一个布局,但是没有选项可以将它作为普通的 HTML 标签进行控制,除此之外,我不能对它使用成帧器运动。

所以我刚刚安装,next-images所以我当然可以导入图像并使用它们,一切正常,直到我 npm run 构建登录页面以查看一些结果,并且有以下警告:

Failed to compile.

./components/Presentation/Presentation.js
77:13  Error: Do not use <img>. Use Image from 'next/image' instead. See https://nextjs.org/docs/messages/no-img-element.  @next/next/no-img-element

Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules

npm ERR! code ELIFECYCLE
Run Code Online (Sandbox Code Playgroud)

这是我使用img带有样式组件的标签的地方:

<PresentationUnderText2 src="/underText-Presentation.png" alt="" />
<PresentationScissor2   src="/scissors.svg"alt=""/>
Run Code Online (Sandbox Code Playgroud)

我该怎么做才能img正常使用标签?

html eslint next.js nextjs-image

10
推荐指数
3
解决办法
4225
查看次数

标签 统计

eslint ×1

html ×1

next.js ×1

nextjs-image ×1