From dc9e27e4b1be668edf8e6f5974b29799d0580e60 Mon Sep 17 00:00:00 2001 From: Zenon Date: Tue, 30 Jan 2018 09:58:25 +0800 Subject: [PATCH] 1.fix bug (#431) * 1.fix bug 2.update treeTable readme 3.update args name in treetable/eval.js * 1.treeTable animate --- src/components/TreeTable/eval.js | 6 +++--- src/components/TreeTable/index.vue | 14 ++++++++++++-- src/components/TreeTable/readme.md | 6 +++--- src/views/example/table/treeTable/customEval.js | 6 +++--- .../example/table/treeTable/customTreeTable.vue | 5 +++-- 5 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/components/TreeTable/eval.js b/src/components/TreeTable/eval.js index dfaac808..d9b89e1c 100644 --- a/src/components/TreeTable/eval.js +++ b/src/components/TreeTable/eval.js @@ -4,11 +4,11 @@ */ 'use strict' import Vue from 'vue' -export default function treeToArray(data, expandedAll, parent = null, level = null) { +export default function treeToArray(data, expandAll, parent = null, level = null) { let tmp = [] Array.from(data).forEach(function(record) { if (record._expanded === undefined) { - Vue.set(record, '_expanded', expandedAll) + Vue.set(record, '_expanded', expandAll) } let _level = 1 if (level !== undefined && level !== null) { @@ -21,7 +21,7 @@ export default function treeToArray(data, expandedAll, parent = null, level = nu } tmp.push(record) if (record.children && record.children.length > 0) { - const children = treeToArray(record.children, expandedAll, record, _level) + const children = treeToArray(record.children, expandAll, record, _level) tmp = tmp.concat(children) } }) diff --git a/src/components/TreeTable/index.vue b/src/components/TreeTable/index.vue index 4ec22447..c33fc886 100644 --- a/src/components/TreeTable/index.vue +++ b/src/components/TreeTable/index.vue @@ -58,7 +58,7 @@ export default { tmp = this.data } const func = this.evalFunc || treeToArray - const args = this.evalArgs ? Array.concat([tmp], this.evalArgs) : [tmp, this.expandAll] + const args = this.evalArgs ? Array.concat([tmp, this.expandAll], this.evalArgs) : [tmp, this.expandAll] return func.apply(null, args) } }, @@ -66,7 +66,7 @@ export default { showRow: function(row) { const show = (row.row.parent ? (row.row.parent._expanded && row.row.parent._show) : true) row.row._show = show - return show ? '' : 'display:none;' + return show ? 'animation:treeTableShow 1s;-webkit-animation:treeTableShow 1s;' : 'display:none;' }, // 切换下级是否展开 toggleExpanded: function(trIndex) { @@ -80,6 +80,16 @@ export default { } } +