mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-12 12:25:22 +08:00
b9853474ec
closed #10937
25 lines
583 B
Vue
25 lines
583 B
Vue
<template>
|
|
<el-cascader :props="props" />
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import type { CascaderProps } from 'element-plus'
|
|
|
|
let id = 0
|
|
const props: CascaderProps = {
|
|
lazy: true,
|
|
lazyLoad(node, resolve) {
|
|
const { level } = node
|
|
setTimeout(() => {
|
|
const nodes = Array.from({ length: level + 1 }).map((item) => ({
|
|
value: ++id,
|
|
label: `Option - ${id}`,
|
|
leaf: level >= 2,
|
|
}))
|
|
// Invoke `resolve` callback to return the child nodes data and indicate the loading is finished.
|
|
resolve(nodes)
|
|
}, 1000)
|
|
},
|
|
}
|
|
</script>
|