From cb528250cae04731f2fa1c89bc5eeb5e012dfdc0 Mon Sep 17 00:00:00 2001 From: fanlin Date: Sat, 24 Jul 2021 16:30:28 +0800 Subject: [PATCH] =?UTF-8?q?bug=EF=BC=9A=E5=9B=BD=E5=86=85=E6=A0=87?= =?UTF-8?q?=E5=87=86=E6=B3=95=E8=A7=84=EF=BC=8C=E7=BC=96=E8=BE=91=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=EF=BC=8C=E5=BA=94=E5=8E=BB=E6=8E=89=E8=A2=AB=E5=BC=95?= =?UTF-8?q?=E7=94=A8=E6=A0=87=E5=87=86=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/treeSelect/treeSelectNew.vue | 14 ++++++++++++++ .../domesticStandardsAndRegulations/index.vue | 1 + 2 files changed, 15 insertions(+) diff --git a/src/components/treeSelect/treeSelectNew.vue b/src/components/treeSelect/treeSelectNew.vue index 1ac8eb973..b8a892ea0 100644 --- a/src/components/treeSelect/treeSelectNew.vue +++ b/src/components/treeSelect/treeSelectNew.vue @@ -218,6 +218,20 @@ this.isShowSelect = !this.isShowSelect; } }, + // 递归 + getTreeData(data) { + // 循环遍历json数据 + for (let i = 0; i < data.length; i++) { + if (data[i].children.length < 1) { + // children若为空数组,则将children设为undefined + delete data[i].children + } else { + // children若不为空数组,则继续 递归调用 本方法 + this.getTreeData(data[i].children) + } + } + return data + }, // 节点选中状态发生变化时的回调 handleCheckChange () { var checkedKeys = this.$refs.tree.getCheckedKeys(); // 所有被选中的节点的 key 所组成的数组数据 diff --git a/src/pages/regulatoryRepository/domesticStandardsAndRegulations/index.vue b/src/pages/regulatoryRepository/domesticStandardsAndRegulations/index.vue index cec1fc816..e34a317ae 100644 --- a/src/pages/regulatoryRepository/domesticStandardsAndRegulations/index.vue +++ b/src/pages/regulatoryRepository/domesticStandardsAndRegulations/index.vue @@ -444,6 +444,7 @@