在遍历之前,先判断是否存在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 return
} }
const lazyTreeNodeMap = table.store.states.lazyTreeNodeMap const lazyTreeNodeMap = table.store.states.lazyTreeNodeMap
const children = lazyTreeNodeMap[crud.getDataId(row)] row.children = lazyTreeNodeMap[crud.getDataId(row)]
row.children = children if (row.children) {
children.forEach(ele => { row.children.forEach(ele => {
const id = crud.getDataId(ele) const id = crud.getDataId(ele)
if (that.dataStatus[id] === undefined) { if (that.dataStatus[id] === undefined) {
that.dataStatus[id] = { that.dataStatus[id] = {
delete: 0, delete: 0,
edit: 0 edit: 0
}
} }
} })
}) }
}) })
} }
} }