tiny-vue/examples/sites/demos/pc/app/cascader/auto-load-checkStrictly.vue

38 lines
794 B
Vue

<template>
<tiny-cascader v-model="value" :props="propsAuto"></tiny-cascader>
</template>
<script>
import { Cascader } from '@opentiny/vue'
export default {
components: {
TinyCascader: Cascader
},
data() {
let id = 0
return {
value: '',
propsAuto: {
lazy: true,
checkStrictly: true,
lazyLoad(node, resolve) {
const { level } = node
setTimeout(() => {
const nodes = Array.from({ length: level + 1 }).map(() => ({
value: ++id,
label: `选项${id}`,
leaf: level >= 2
}))
// 通过调用 resolve 将子节点数据返回,通知组件数据加载完成
resolve(nodes)
}, 1000)
}
}
}
}
}
</script>