ztree 简单应用一

1:代码部分


<div>
    <ul id="" class=""></ul>
</div>
<!-- lang: js -->
<script> 
var nodes2 = [
    {id: 1, pId: 0, name: "parent1"},
    {id: 11, pId: 1, name: "children1"},
    {id: 12, pId: 1, name: "children2"},
    {id: 2, pId: 0, name: "parent2"},
    {id: 21, pId: 2, name: "children1"},
    {id: 22, pId: 2, name: "children2"},
    {id: 3, pId: 0, name: "parent3"},
    {id: 31, pId: 3, name: "children1"},
    {id: 32, pId: 3, name: "children2"},
];   
var setting = {
    data: {
        simpleData: {
            enable: true
        }
    }
};
$(document).ready(function () {
    $.fn.zTree.init($("#treeDemo"), setting, nodes2);
})</script>

2:实验结果

在此输入图片描述

3:小结

你可能感兴趣的:(ztree)