From ffdd68f4671629525e561998ef8100630a7cb176 Mon Sep 17 00:00:00 2001 From: dwqs <461147874@qq.com> Date: Thu, 15 Mar 2018 14:37:27 +0800 Subject: [PATCH] feat: Add updateScrollbar method --- src/components/table.vue | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/components/table.vue b/src/components/table.vue index 684ca6e..b68f881 100644 --- a/src/components/table.vue +++ b/src/components/table.vue @@ -447,11 +447,7 @@ if (this.isMetLazyLoad) { this.initRenderRows(); if (this.scrollbar) { - this.$nextTick(() => { - this.scrollbar.update({ - contentHeight: this.contentHeight - }); - }); + this.updateScrollbar(); } } else { this.rows = [].concat(val); @@ -487,6 +483,7 @@ }, methods: { + // exposed table method toggleRowSelection (row, selected) { const curIndex = findIndex(this.rows, row); @@ -503,6 +500,18 @@ } }, + updateScrollbar () { + if (this.scrollbar) { + this.$nextTick(() => { + this.scrollbar.update({ + contentWidth: this.$refs.content.scrollWidth, + contentHeight: this.isMetLazyLoad ? this.contentHeight : this.$refs.content.scrollHeight + }); + }); + } + }, + // exposed table method --end + toggleSelect (rowIndex) { if (this.selectedIndex.includes(rowIndex)) { this.handleRowSelect(false, rowIndex);