element-plus/docs/examples/tree-select/lazy.vue
kooriookami 5844947198
refactor(components): [select & select-v2] Refactor components (#15352)
* refactor(components): [select&select-v2] refactor components

* refactor(components): [select-v2]

* refactor(components): update

* refactor(components): update

* refactor(components): [select-v2]

update

* refactor(components): update

* refactor(components): update

* refactor(components): update type

* refactor(components): update

* refactor(components): update

* refactor(components): update style

* refactor(components): update docs

* refactor(components): update

* refactor(components): fix #15323

* refactor(theme-chalk): update

* refactor(components): update

* refactor(components): update

* refactor(components): update

* refactor(components): fix bugs

* fix(components): fix issue

* fix(components): update

* fix(components): fix some bug

* feat(components): update

* feat(components): add tag slot

* feat(components): update

* fix(components): update

* style(theme-chalk): update style

* fix(theme-chalk): update

* feat(theme-chalk): update

* fix(components): update

* feat: update

* feat: update

* feat: update

* feat(components): update
2024-01-10 11:14:58 +08:00

55 lines
911 B
Vue

<template>
<el-tree-select
v-model="value"
lazy
:load="load"
:props="props"
style="width: 240px"
/>
<el-divider />
<VersionTag version="2.2.26" /> show lazy load label:
<el-tree-select
v-model="value2"
lazy
:load="load"
:props="props"
:cache-data="cacheData"
style="width: 240px"
/>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
const value = ref()
const value2 = ref(5)
const cacheData = [{ value: 5, label: 'lazy load node5' }]
const props = {
label: 'label',
children: 'children',
isLeaf: 'isLeaf',
}
let id = 0
const load = (node, resolve) => {
if (node.isLeaf) return resolve([])
setTimeout(() => {
resolve([
{
value: ++id,
label: `lazy load node${id}`,
},
{
value: ++id,
label: `lazy load node${id}`,
isLeaf: true,
},
])
}, 400)
}
</script>