From 06f16f78e7664e1feb7d3f8942aafb01bc2fc77e Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Thu, 25 Aug 2016 11:51:25 +0800 Subject: [PATCH] Table: render asynchronous data --- packages/table/src/table.vue | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/table/src/table.vue b/packages/table/src/table.vue index 17f9eea3a..f70edffd1 100644 --- a/packages/table/src/table.vue +++ b/packages/table/src/table.vue @@ -312,7 +312,6 @@ }, created() { - this.tableData = this.data; this.gridId = 'grid_' + gridIdSeed + '_'; if (GUTTER_WIDTH === undefined) { @@ -370,6 +369,10 @@ this.$calcHeight(value); }, + data(val) { + this.tableData = val; + }, + tableData(newVal) { this.doOnDataChange(newVal); this.updateScrollInfo(); @@ -408,14 +411,16 @@ this.updateScrollInfo(); if (this.fixedColumnCount > 0) { this.$nextTick(() => { - this.$refs.fixed.style.height = this.$el.clientHeight + 'px'; + const style = this.$refs.fixed.style; + if (!style) return; + style.height = this.$el.clientHeight + 'px'; }); } }, data() { return { - tableData: [], + tableData: this.data, showHScrollBar: false, showVScrollBar: false, hoverRowIndex: null,