网格中的手风琴将内容推迟

发布于 2025-02-05 03:29:06 字数 479 浏览 3 评论 0 原文

我在下面的Codesandbox中有一条手风琴网格。问题是当我打开一项手风琴时,它将下面的所有手风琴推向下面的所有手风琴,而所需的行为只是将其下方的手风琴及其下排的其他手风琴推向同一位置。在以下代码中需要更改什么才能获得此效果?

I have a grid of accordions like in the codesandbox below. The problem is when I open one of the accordions, it pushes down all the accordions in the row below, whereas the desired behaviour is to just push down the accordion right below it and the other accordions in the lower row staying in the same place. What needs to be changed in the following code to get this effect?

https://codesandbox.io/s/basicaccordion-demo-material-ui-forked-sw4juk?file=/demo.tsx

enter image description here

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

请别遗忘我 2025-02-12 03:29:06

您可以利用网格组件的功能来获得所需的行为。网格中的嵌套网格是魔术酱:

“

要使用材料 grid 组件进行此操作,布局将需要如此:

​href =“ https://codesandbox.io/s/column-indeppent-accordions-accordions-wtv2xi?file=/demo.tsx” rel =“ nofollow noreferrer”>示例(i vorked your sand box)

“ https://i.sstatic.net/cuhzw.png” rel =“ nofollow noreferrer”>

You can utilize the power of the Grid component to get your desired behavior. Nesting grids within grids is the magic sauce:

Grid Layout

To do this with the material Grid component, the layout will need to be as such:

enter image description here

EXAMPLE (I forked your sandbox)

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文