<div class="eletree10"></div>
<script>
var el = eleTree({
el: '.eletree10',
showCheckbox: true,
highlightCurrent: true,
lazy: true,
icon: {
loading: ".eleTree-animate-rotate.eletree_icon-loading1",
},
data: [
{"label": "安徽省","id": "01",},
{"label": "河南省","id": "02","isLeaf": true},
{"label": "江苏省","id": "03","isLeaf": true}
],
})
el.on('lazyload', function(d) {
var data = d.data;
var load = d.load;
var loadData = [];
switch (data.id) {
case "01":
loadData = [
{"label": "合肥市","id": "0101","isLeaf": true},
{"label": "马鞍山市","id": "0102",},
]
break;
case "0102":
loadData = [
{"label": "花山区","id": "010201","isLeaf": true},
{"label": "雨山区","id": "010202",},
]
break;
default:
break;
}
setTimeout(function() {
load(loadData)
}, 500)
})
</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
38
39
40
41
42