<el-tree
class="filter-tree"
:data="dataChecked"
:empty-text="emptyText"
:props="defaultProps"
default-expand-all
draggable
:allow-drop="collapse"
:filter-node-method="filterNode"
>
</el-tree>
data和methods中数据
dataChecked: [],
defaultProps: {
children: "children",
label: "name"
},
emptyText: "", // 当树状图没有数据时显示的数据,这里默认啥都不显示
// 拖拽控制
collapse(moveNode, inNode, type) {
// 不能拖拽到级别里面
if (type === "inner") return;
if (moveNode.nextSibling === undefined) {
return type === "prev";
} else if (inNode.nextSibling === undefined) {
return type === "next";
} else if (moveNode.nextSibling.id !== inNode.id) {
return type === "prev";
} else {
return type === "next";
}
},