mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-27 05:00:48 +08:00
487001d697
.demo.md for component demo .demo-entry.md for demo entry .md for common docs
813 B
813 B
Async Multiple (Leaf Only)
<n-cascader
v-model="value"
multiple
placeholder="Please Select Something"
:options="options"
style="flex-grow: 1; margin-right: 12px;"
remote
:on-load="handleLoad"
/>
function genChildren (option) {
const children = []
for (let i = 0; i <= option.depth; ++i) {
children.push({
label: option.label + '_' + i,
value: option.label + '_' + i,
isLeaf: option.depth === 3
})
}
return children
}
const options = [
{
label: 'Root',
value: 'root',
isLeaf: false
}
]
export default {
data () {
return {
value: null,
options: options
}
},
methods: {
handleLoad (option, resolve) {
window.setTimeout(() => {
resolve(genChildren(option))
}, 1000)
}
}
}