在遍历之前,先判断是否存在row.children (#103)

Cannot read property 'forEach' of undefined
展开日志详情报错,找不到forEach属性
This commit is contained in:
perye
2020-09-05 09:56:04 +08:00
committed by GitHub
parent fbbcbb7d4d
commit 42348c150b

View File

@@ -511,17 +511,18 @@ function CRUD(options) {
return
}
const lazyTreeNodeMap = table.store.states.lazyTreeNodeMap
const children = lazyTreeNodeMap[crud.getDataId(row)]
row.children = children
children.forEach(ele => {
const id = crud.getDataId(ele)
if (that.dataStatus[id] === undefined) {
that.dataStatus[id] = {
delete: 0,
edit: 0
row.children = lazyTreeNodeMap[crud.getDataId(row)]
if (row.children) {
row.children.forEach(ele => {
const id = crud.getDataId(ele)
if (that.dataStatus[id] === undefined) {
that.dataStatus[id] = {
delete: 0,
edit: 0
}
}
}
})
})
}
})
}
}