mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-15 01:41:20 +08:00
40 lines
675 B
Vue
40 lines
675 B
Vue
|
<template>
|
||
|
<el-tree :props="props" :load="loadNode" lazy show-checkbox />
|
||
|
</template>
|
||
|
|
||
|
<script lang="ts">
|
||
|
export default {
|
||
|
data() {
|
||
|
return {
|
||
|
props: {
|
||
|
label: 'name',
|
||
|
children: 'zones',
|
||
|
isLeaf: 'leaf',
|
||
|
},
|
||
|
}
|
||
|
},
|
||
|
methods: {
|
||
|
loadNode(node, resolve) {
|
||
|
if (node.level === 0) {
|
||
|
return resolve([{ name: 'region' }])
|
||
|
}
|
||
|
if (node.level > 1) return resolve([])
|
||
|
|
||
|
setTimeout(() => {
|
||
|
const data = [
|
||
|
{
|
||
|
name: 'leaf',
|
||
|
leaf: true,
|
||
|
},
|
||
|
{
|
||
|
name: 'zone',
|
||
|
},
|
||
|
]
|
||
|
|
||
|
resolve(data)
|
||
|
}, 500)
|
||
|
},
|
||
|
},
|
||
|
}
|
||
|
</script>
|