在我的一个组件中,我需要以下两项:
import Image from 'next/image';(来自NextJS)
Image()(来自 TypeScript)
而这两者是相互冲突的。
是否可以为 指定不同的名称next/image?我试过
import Image as image from 'next/image';
和
import {Image as image} from 'next/image';
但他们没有工作。
有两种方法:
// CommonJS style
const { default: NextImage } = require("next/image");
Run Code Online (Sandbox Code Playgroud)
// ES module style
import NextImage from "next/image";
// alternatively
import { default as NextImage } from "next/image";
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2166 次 |
| 最近记录: |