我想把一个图像放在一个div中,但我只想指定宽度并保持长宽比。下面是我的代码:
<motion.div
initial={{ opacity: 0, transform: "translateZ(0)" }}
animate={{ opacity: 1, transform: "translateZ(0)" }}
transition={{ duration: 1, ease: 'easeInOut' }}
className='w-[400px] md:w-[500px] relative'>
<Image
alt={nume}
layout="responsive"
objectFit="cover"
width={200}
height={200}
src={poza}
/>
</motion.div>
字符串
我应该怎么做才不会在控制台中收到此警告?
Image with src "https://firebasestorage.googleapis.com/...." has legacy prop "objectFit". Did you forget to run the codemod?
型
1条答案
按热度按时间vuktfyat1#
根据documentation,
objectFit
属性似乎已被弃用。如果你搜索objectFit,你会看到他们建议这样实现:
字符串