From 11f2367589987ca11af8729b7d115b8a69c50841 Mon Sep 17 00:00:00 2001 From: Aresn Date: Fri, 17 Sep 2021 14:58:55 +0800 Subject: [PATCH] simplify --- src/components/table/table.vue | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/components/table/table.vue b/src/components/table/table.vue index ef14b503..00409fa7 100644 --- a/src/components/table/table.vue +++ b/src/components/table/table.vue @@ -497,12 +497,9 @@ let style = {}; if (this.bodyHeight !== 0) { let height = this.bodyHeight - (this.showHorizontalScrollBar?this.scrollBarWidth:0); - if(this.height) { - style.height = this.showHorizontalScrollBar ? `${height}px` : `${height - 1}px`; - } else if (this.maxHeight) { - style.maxHeight = this.showHorizontalScrollBar ? `${height}px` : `${height - 1}px`; - } - + const bodyHeight = this.showHorizontalScrollBar ? `${height}px` : `${height - 1}px`; + if (this.height) style.height = bodyHeight; + else if (this.maxHeight) style.maxHeight = bodyHeight; } return style; },