原文:
<template>
<div>
<TreeVue :data="data"></TreeVue>
</div>
</template>
<script setup lang='ts'>
import { ref, reactive } from 'vue';
import TreeVue from "./components/Tree.vue";
interface Tree {
name:string,
checked: boolean,
children?: Tree[]
}
const data = reactive<Tree[]>([
{
name:"1",
checked:false,
children:[
{
name:"1-1",
checked:false
}
]
},
{
name:"2",
checked:false
},
{
name:"3",
checked:false,
children:[
{
name:"3-1",
checked:false,
children:[
{
name:"3-1-1",
checked:false
},
{
name:"3-1-2",
checked:false
}
]
}
]
}
])
</script>
<style lang="less">
</style>
"原文" 代码复制黏贴到 微信 公众号 编辑器后 内容 丢失