From e06874281e099495116d3c3c3956ac8e449ef54a Mon Sep 17 00:00:00 2001 From: qinjie Date: Wed, 1 Sep 2021 14:44:31 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E7=BB=87=E7=BB=93=E6=9E=84=E6=A0=91?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E7=BB=84=E4=BB=B6=E9=BB=98=E8=AE=A4=E9=80=89?= =?UTF-8?q?=E4=B8=AD=E7=AC=AC=E4=B8=80=E4=B8=AA=E8=8A=82=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/OrgTree/Index.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/OrgTree/Index.vue b/src/components/OrgTree/Index.vue index 70feb80..c53935e 100644 --- a/src/components/OrgTree/Index.vue +++ b/src/components/OrgTree/Index.vue @@ -108,8 +108,14 @@ export default { this.selectKey = this.defaultOrganizationId; this.$emit('getSelectTreeKey', this.selectKey); } + } else { + // 如果没有传入默认显示节点 则自动显示树的第一个 + let firstNode = this.treeData[0]; + this.defaultSelectedKeys.push(firstNode.key); + this.selectTitle = firstNode.title; + this.selectKey = firstNode.key; + this.$emit('getSelectTreeKey', this.selectKey); } - console.log(this.defaultSelectedKeys) }, methods: { // 点击组织机构数节点时调用