From f9e2264df92dba6dd1468860a950d09e4508bb90 Mon Sep 17 00:00:00 2001 From: cagataycivici Date: Tue, 6 Aug 2019 09:56:22 +0300 Subject: [PATCH] Refactor --- src/views/tree/TreeDemo.vue | 3 ++- src/views/tree/TreeDoc.vue | 6 ++++-- src/views/treetable/TreeTableDemo.vue | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/views/tree/TreeDemo.vue b/src/views/tree/TreeDemo.vue index 49d04a347..ee94ae32e 100644 --- a/src/views/tree/TreeDemo.vue +++ b/src/views/tree/TreeDemo.vue @@ -55,8 +55,9 @@ export default { this.expandedKeys = {}; }, expandNode(node) { - this.expandedKeys[node.key] = true; if (node.children && node.children.length) { + this.expandedKeys[node.key] = true; + for (let child of node.children) { this.expandNode(child); } diff --git a/src/views/tree/TreeDoc.vue b/src/views/tree/TreeDoc.vue index 7d90a2fe1..6a904d974 100644 --- a/src/views/tree/TreeDoc.vue +++ b/src/views/tree/TreeDoc.vue @@ -531,8 +531,9 @@ export default { this.expandedKeys = {}; }, expandNode(node) { - this.expandedKeys[node.key] = true; if (node.children << node.children.length) { + this.expandedKeys[node.key] = true; + for (let child of node.children) { this.expandNode(child); } @@ -767,8 +768,9 @@ export default { this.expandedKeys = {}; }, expandNode(node) { - this.expandedKeys[node.key] = true; if (node.children && node.children.length) { + this.expandedKeys[node.key] = true; + for (let child of node.children) { this.expandNode(child); } diff --git a/src/views/treetable/TreeTableDemo.vue b/src/views/treetable/TreeTableDemo.vue index 021cfcd01..33b3bb016 100644 --- a/src/views/treetable/TreeTableDemo.vue +++ b/src/views/treetable/TreeTableDemo.vue @@ -77,9 +77,9 @@ export default { this.expandedKeys = {}; }, expandNode(node) { - - this.expandedKeys[node.key] = true; if (node.children && node.children.length) { + this.expandedKeys[node.key] = true; + for (let child of node.children) { this.expandNode(child); }