$(function(){
var zTreeObj;
var zSettings={ //设置父子级关系
data:{
simpleData:{
enable: true, //启用简单模式
idKey: "id",
pIdKey: "pid"
}
},
check:{
enable:false
},
view:{
showIcon: true,
showLine: false,
showTitle: false
}
};
var zNodes=[
{id:"1",pid:"0",name:"数据"},
{id:"2",pid:"1",name:"管理"},
{id:"2-1",pid:"2",name:"1区"},
{id:"2-2",pid:"2",name:"2区"},
{id:"2-3",pid:"2",name:"3区"},
];
//构造树的方法
zTreeObj = $.fn.zTree.init($("#zTree"),zSettings,zNodes);
//展示全部节点
// zTreeObj.expandAll(true);
});
<div id="zTree" class="zTree"></div>
ztree直例小模板
最新推荐文章于 2019-12-10 16:58:34 发布