效果显示:
代码
//节点高亮
var nodes = document.getElementsByClassName("layui-tree-txt");
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].innerHTML === obj.data.title){
nodes[i].style.color = "#006BF9";
nodes[i].style.fontWeight = "bold";
} else {
nodes[i].style.color = "#555";
nodes[i].style.fontWeight = "normal";
}
}
亲测使用