mirror of
https://github.com/element-plus/element-plus.git
synced 2025-08-14 18:11:48 +08:00

* 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>
46 lines
734 B
Vue
46 lines
734 B
Vue
<template>
|
|
<el-tree
|
|
style="max-width: 600px"
|
|
:props="props"
|
|
:load="loadNode"
|
|
lazy
|
|
show-checkbox
|
|
/>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import type Node from 'element-plus/es/components/tree/src/model/node'
|
|
|
|
interface Tree {
|
|
name: string
|
|
leaf?: boolean
|
|
}
|
|
|
|
const props = {
|
|
label: 'name',
|
|
children: 'zones',
|
|
isLeaf: 'leaf',
|
|
}
|
|
|
|
const loadNode = (node: Node, resolve: (data: Tree[]) => void) => {
|
|
if (node.level === 0) {
|
|
return resolve([{ name: 'region' }])
|
|
}
|
|
if (node.level > 1) return resolve([])
|
|
|
|
setTimeout(() => {
|
|
const data: Tree[] = [
|
|
{
|
|
name: 'leaf',
|
|
leaf: true,
|
|
},
|
|
{
|
|
name: 'zone',
|
|
},
|
|
]
|
|
|
|
resolve(data)
|
|
}, 500)
|
|
}
|
|
</script>
|