mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-27 05:00:48 +08:00
466 B
466 B
Basic
<n-tree
:data="data"
checkable
/>
let key = 0
function genData (layer = 4, depth = 0, prefix = '') {
if (layer === depth) return
const data = []
const count = 4
for (let i = 0; i < count; ++i) {
data.push({
label: `${prefix}_${i}`,
key: key++,
children: genData(layer, depth + 1, `${prefix}_${i}`)
})
}
return data
}
export default {
data () {
return {
data: genData()
}
}
}