This commit is contained in:
liugq 2019-02-15 13:37:20 +08:00
parent b6845ba586
commit 9225e5ab83
1 changed files with 3 additions and 3 deletions

View File

@ -3,11 +3,11 @@ import Vue from 'vue'
// 给数据添加额外的几个属性,并且扁平化数组
export default function treeToTable(
data,
{ parent = null, leavel = 0, expand = false, children = 'children', show = true, select = false } = {}
{ parent = null, level = 0, expand = false, children = 'children', show = true, select = false } = {}
) {
let tmp = []
data.forEach(item => {
Vue.set(item, '__leavel', leavel)
Vue.set(item, '__level', level)
Vue.set(item, '__expand', expand)
Vue.set(item, '__parent', parent)
Vue.set(item, '__show', show)
@ -17,7 +17,7 @@ export default function treeToTable(
if (item[children] && item[children].length > 0) {
const res = treeToTable(item[children], {
parent: item,
leavel: leavel + 1,
level: level + 1,
expand,
children,
status,