Bootstrap

ElEMENTPLUS树图实现单选且只有叶子节点可选

1只有叶子节点可选

.el-tree-node{ 
            .is-leaf + .el-checkbox .el-checkbox__inner{ 
                display: inline-block;
            }
            .el-checkbox .el-checkbox__inner{ 
                display: none;
            }
        }

2.实现单选

<eltree> 加上
          @node-click="handleNodeClick"
          @check-change="checkChange"
const handleNodeClick = (item, node, self) =>
{
  state.editCheckId = item.id;/*接收当前带你就的节点id  */
  treeRef.value.setCheckedKeys([item.id])
}

const checkChange = (item, node, self) => {
  if (node == true) {
    state.editCheckId = item.id;
    treeRef.value.setCheckedKeys([item.id])
  } else {
    if (state.editCheckId == item.id) {
      treeRef.value.setCheckedKeys([item.id])
    }
  }
}
;