简体   繁体   English

在 next.js 项目中的 Material UI cardMedia 中加载 Static 图像路径

[英]loading Static image path inside Material UI cardMedia in next.js project

i'm trying to load a static image into Material UI CardMedia我正在尝试将 static 图像加载到 Material UI CardMedia

const useStyles = makeStyles((theme) => ({
   media: {
     height: 0,
     paddingTop: "56.25%", // 16:9
    },
 }));

<CardMedia
 className={css.media}
 image="https://i.ibb.co/VvD4prS/Rectangle-185.png" 
 title="Paella dish"
 component="img"
 />              

I can't see my image我看不到我的图片

how can I use images inside Material UI cardMedia in a next.js project如何在 next.js 项目中使用 Material UI cardMedia 中的图像

codeSandBox https://codesandbox.io/s/angry-chihiro-wfjnz?file=/pages/index.js codeSandBox https://codesandbox.io/s/angry-chihiro-wfjnz?file=/pages/index.js

Thanks in Advance提前致谢

i Fixed the issue the media Height needed to be set to 100% i 修复了媒体高度需要设置为 100% 的问题

const useStyles = makeStyles((theme) => ({
   media: {
     height: "100%",
     paddingTop: "56.25%", // 16:9
    },
 }));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM