mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-11-30 02:08:12 +08:00
48a056b051
* docs: modify layout style * docs: modify nav padding * docs: update style * feat: update * docs: upadte * docs: update * docs: modify layout style * docs: update style * feat: update * docs: upadte * docs: update * docs: update * docs: update * docs: remove empty script * docs: update --------- Co-authored-by: kooriookami <bingshuanglingluo@163.com> Co-authored-by: kooriookami <38392315+kooriookami@users.noreply.github.com>
83 lines
1.3 KiB
Vue
83 lines
1.3 KiB
Vue
<template>
|
|
<el-tree
|
|
style="max-width: 600px"
|
|
: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',
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
{
|
|
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',
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
]
|
|
|
|
const defaultProps = {
|
|
children: 'children',
|
|
label: 'label',
|
|
}
|
|
</script>
|