<div class="eletree12"></div>
<script>
var f=function(maxFloor, everyFloorMuch, d, obj) {
d = d || []
obj = obj || {floor: 0, index: 0}
obj.floor++
for(var i=0;i<everyFloorMuch;i++){
obj.index++
var o={
"label": "节点"+obj.index,
"id": obj.index,
"children": [],
"checked": true,
"radioChecked": true
}
d[i] ? d[i].children.push(o) : d.push(o)
if(obj.floor<maxFloor){
f(maxFloor, everyFloorMuch, d[i].children, obj)
}
}
obj.floor--
return d
}
var el = eleTree({
el: '.eletree12',
showCheckbox: true,
highlightCurrent: true,
showRadio: true,
data: f(4, 20)
})
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37