mirror of
https://github.com/element-plus/element-plus.git
synced 2024-12-21 02:50:11 +08:00
0bdd0fa7ea
Co-authored-by: xiaochenchen <xiaochen.chen@igg.com>
36 lines
555 B
Vue
36 lines
555 B
Vue
<template>
|
|
<el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick" />
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
interface Tree {
|
|
label: string
|
|
children?: Tree[]
|
|
}
|
|
|
|
const handleNodeClick = (data: Tree) => {
|
|
console.log(data)
|
|
}
|
|
|
|
const data: Tree[] = [
|
|
{
|
|
label: 'Level one 1',
|
|
children: [
|
|
{
|
|
label: 'Level two 1-1',
|
|
children: [
|
|
{
|
|
label: 'Level three 1-1-1',
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
]
|
|
|
|
const defaultProps = {
|
|
children: 'children',
|
|
label: 'label',
|
|
}
|
|
</script>
|