为什么网格项目材料UI V5无法正常工作?

发布于 2025-02-05 15:49:32 字数 807 浏览 1 评论 0原文

我遇到了MUI V5的网格组件的问题。如果在沙箱中写代码 - 它是有效的问题。我发现我必须给出sx = {{'& .muigrid-root':{flexgrow:'1'}到我的网格容器。但是我的物品属性仍然无法使用。知道我错过了什么吗?

   <Paper sx={{ padding: 5, height: '100%' }} >
        <Grid container spacing={4} sx={{border:'1px solid red','& .MuiGrid-root':{flexGrow: '1'},}}>
            <Grid item item xs={12} sm={12} md={12} lg={6} xl={4} sx={{border:'1px solid blue',}}> grid 1</Grid>
            <Grid item xs={2} sx={{border:'1px solid blue',}}> grid 2</Grid>
            <Grid item xs={6} sx={{border:'1px solid blue',}}> grid 3</Grid>
        </Grid>
    </Paper>

结果让我失望 result

版本如果mui:“@mui/yater

I faced with a problem with usage of Grid component from MUI V5. The problem that if write code in sandbox - it's works. I find out that i have to give sx={{'& .MuiGrid-root': { flexGrow: '1' } to my Grid container. But still my items property of xs doesn't works. Any idea what i missed?

   <Paper sx={{ padding: 5, height: '100%' }} >
        <Grid container spacing={4} sx={{border:'1px solid red','& .MuiGrid-root':{flexGrow: '1'},}}>
            <Grid item item xs={12} sm={12} md={12} lg={6} xl={4} sx={{border:'1px solid blue',}}> grid 1</Grid>
            <Grid item xs={2} sx={{border:'1px solid blue',}}> grid 2</Grid>
            <Grid item xs={6} sx={{border:'1px solid blue',}}> grid 3</Grid>
        </Grid>
    </Paper>

And the result just disappointment me
result

Version if MUI : "@mui/material": "^5.8.2",

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文