mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-14 17:31:02 +08:00
80 lines
1.6 KiB
Vue
80 lines
1.6 KiB
Vue
|
<template>
|
||
|
<el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick" />
|
||
|
</template>
|
||
|
|
||
|
<script lang="ts">
|
||
|
export default {
|
||
|
data() {
|
||
|
return {
|
||
|
data: [
|
||
|
{
|
||
|
label: 'Level one 1',
|
||
|
children: [
|
||
|
{
|
||
|
label: 'Level two 1-1',
|
||
|
children: [
|
||
|
{
|
||
|
label: 'Level three 1-1-1',
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
{
|
||
|
label: 'Level one 2',
|
||
|
children: [
|
||
|
{
|
||
|
label: 'Level two 2-1',
|
||
|
children: [
|
||
|
{
|
||
|
label: 'Level three 2-1-1',
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
{
|
||
|
label: 'Level two 2-2',
|
||
|
children: [
|
||
|
{
|
||
|
label: 'Level three 2-2-1',
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
{
|
||
|
label: 'Level one 3',
|
||
|
children: [
|
||
|
{
|
||
|
label: 'Level two 3-1',
|
||
|
children: [
|
||
|
{
|
||
|
label: 'Level three 3-1-1',
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
{
|
||
|
label: 'Level two 3-2',
|
||
|
children: [
|
||
|
{
|
||
|
label: 'Level three 3-2-1',
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
],
|
||
|
defaultProps: {
|
||
|
children: 'children',
|
||
|
label: 'label',
|
||
|
},
|
||
|
}
|
||
|
},
|
||
|
methods: {
|
||
|
handleNodeClick(data) {
|
||
|
console.log(data)
|
||
|
},
|
||
|
},
|
||
|
}
|
||
|
</script>
|
||
|
```
|