//去掉一级复选框
getChecked = () => {
//获取到zTree
let allNodes = this.zTreeCatalog.getNodes()
if (allNodes.length > 0) {
for (let i = 0; i < allNodes.length; i++) {
if (allNodes[i].isParent) {
allNodes[i].nocheck = true;//nocheck为true表示没有选择框
}
}
}
}
this.zTreeCatalog = global.zTreeCatalog = $.fn.zTree.init($("#layerCatalog"), setting, list);
nocheck:true;不显示复选框,
isParent:第一级显示目录
第一种:通过传递的参数:treeNode可以获取到层级
treeNode.level
第二种:
var treeObj = $.fn.zTree.getZTreeObj("tree");
var sNodes = treeObj.getSelectedNodes();
if (sNodes.length > 0) {
var level = sNodes[0].level;
}