我知道在 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正常使用标签?