我试图使用import Image from 'next/image';
在下一个js中显示图像,但不指定宽度和高度.
Note that image is coming from URL and not from specific folder in project.
<Image
sizes={"100vw"}
width={0}
height={0}
src={'https://picsum.photos/200/300'}
placeholder='empty' />
如果我从文件夹导入图像,则此代码有效,但当try 从URL显示图像时,则会失败.
有人知道如何在不添加宽度和高度属性的情况下渲染图像吗?
我还想保留原始大小,而不是使用fill
和objectFit
属性将图像覆盖在所有屏幕上