如何让React Flow中的边出现在节点上方?

问题描述 投票:0回答:2

我正在使用 React Flow v9,我想让边缘出现在节点上方。我尝试将节点的 z 索引设置为 0 或将边的 z 索引设置为 100,但它们似乎不起作用。它总是回退到 z 索引为 3 的节点和 z 索引为 2 的边。

有办法获得这种行为吗?

reactjs react-flow
2个回答
4
投票

为了以后记录,我发现申请了

.react-flow__node {
   z-index: -1 !important;
}

将覆盖默认的

z-index: 1000
并且
-1
将显示在所有
z-index: auto
的下方,这是默认值。

来自 https://reactflow.dev/docs/guides/theming/#react-flow-class-names

的类名称

0
投票
.react-flow__node {
   z-index: -1 !important;
}

为我工作,谢谢!我自己通过对节点列表进行排序来控制节点的渲染顺序,因此停用此 CSS 属性对我来说是一个举措。

© www.soinside.com 2019 - 2024. All rights reserved.