1.要实现的效果如下图所示:
2.参考ztree官网:http://www.treejs.cn/v3/api.php
3.显现代如下:
function getDeptNode() {
var zNodes = [];
$.ajax({
url: "",
data: {},
async: false,
success: function (res) {
console.log('res',res);
if (res.data.length > 0) {
zNodes = res.data;
zNodes[0].open = true;
}
}
});
return zNodes;
}