vue3.0+ts 简易树 实现


com-tree.vue






tree-node-dom.vue






使用
    // 树组件的接口
interface treeListInterface {
id: number,
label: string,
custom?: any,
children?: treeListInterface[],
}
let treeList = reactive([
{
id: 1,
label: '1',
children: [
{
id: 1,
label: '1-1',
}
]
},
{
id: 1,
label: '2',
children: [
{
id: 1,
label: '2-1',
}
]
}
]);
vue