From 42348c150baf9a03cd8b599da9e91f59d36066ac Mon Sep 17 00:00:00 2001 From: perye <11143526@qq.com> Date: Sat, 5 Sep 2020 09:56:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E9=81=8D=E5=8E=86=E4=B9=8B=E5=89=8D?= =?UTF-8?q?=EF=BC=8C=E5=85=88=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6=E5=AD=98?= =?UTF-8?q?=E5=9C=A8row.children=20(#103)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cannot read property 'forEach' of undefined 展开日志详情报错,找不到forEach属性 --- src/components/Crud/crud.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/components/Crud/crud.js b/src/components/Crud/crud.js index 8976f77..7109ed7 100644 --- a/src/components/Crud/crud.js +++ b/src/components/Crud/crud.js @@ -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 + } } - } - }) + }) + } }) } }