<input type="text" class="search">
<button class="btn">搜索</button>
<div class="eletree11"></div>
<script>
var el1 = eleTree({
el: '.eletree11',
url: '/eleTree/json/1.json?v=2.0.12',
highlightCurrent: true,
showCheckbox: true,
showRadio: true,
imgUrl: "/eleTree/images/",
icon: {
fold: "fold.png",
leaf: "leaf.png",
checkFull: ".eletree_icon-check_full",
checkHalf: ".eletree_icon-check_half",
checkNone: ".eletree_icon-check_none",
dropdownOff: ".eletree_icon-dropdown_right",
dropdownOn: ".eletree_icon-dropdown_bottom",
loading: ".eleTree-animate-rotate.eletree_icon-loading1",
},
})
document.querySelector(".btn").onclick = function() {
el1.search(document.querySelector(".search").value, function(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
})
}
</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