tree-elementui
v1.0.1
Published
Generating tree format in elementui from one-dimensional array data
Downloads
3
Readme
该module是为了将一位数组转换成elementui中生成树的格式
- 示例代码
let getTree = require('./index.js')
var tree = [
{ id: 1, parentId: 0, name: "父节点1 - 展开" },
{ id: 11, parentId: 1, name: "父节点11 - 折叠" },
{ id: 12, parentId: 1, name: "父节点12 - 折叠" },
{ id: 13, parentId: 1, name: "父节点13 - 没有子节点" },
{ id: 2, parentId: 0, name: "父节点2 - 折叠" },
{ id: 21, parentId: 2, name: "父节点21 - 展开", },
{ id: 22, parentId: 2, name: "父节点22 - 折叠" },
{ id: 23, parentId: 2, name: "父节点23 - 折叠" },
{ id: 3, parentId: 0, name: "父节点3 - 没有子节点" }
]
let data = getTree(tree)