bootstrap-treeview添加id

 bootstrap-treeview中只有自增的参数data-nodeid,没有id的参数,不方便后台交互,修改源码添加id。 

var tree = [
    {
        text:"Parent 1",
        nodeid:"10",//增加的参数
        nodes: [
            {
                text:"Child 1",
                nodeid:"101",//增加的参数
                nodes: [
                    {
                        text:"Grandchild 1",
                        nodeid:"102"
                    },
                    {
                        text:"Grandchild 2",
                        nodeid:"103"
                    }
                ]
            },
            {
                text:"Child 2",
                nodeid:"11"
            }
        ]
    }
];
F12查看结果:添加了自定义的id。

猜你喜欢

转载自blog.csdn.net/irene1991/article/details/79624477