首页 > 解决方案 > React-sortable-tree 节点高度增量问题

问题描述

如图所示,我在 react-sortable-tree 中有两个节点。默认情况下,包提供的行高约为 61px,如果我将行的大小增加到 84px,那么这两行就会相交,有什么办法吗?我尝试操纵 css 但找不到解决方案...

我应用的 CSS 样式是

.rstcustom__rowWrapper {
    padding: 10px 10px 10px 0;
    height: 84px;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    cursor: move;
}

增加高度时的行 在此处输入图像描述

标签: reactjs

解决方案


添加:

<SortableTree
      ...
      treeData={state}
      rowHeight={}// multiple of base height for example
      generateNodeProps={({ node, path }) => {
      ...

rowHeight 作为 SortableTree 组件中的道具。避免直接更改 CSS,使用文档中描述的 style、rowHeight、innerStyle 道具


推荐阅读