From 91498790fd969030cf78250d7ba268279cf83121 Mon Sep 17 00:00:00 2001 From: youluna Date: Fri, 22 Mar 2019 18:05:46 +0800 Subject: [PATCH] fix(Table): style confusion caused by vertical scrollbar, close #473 --- src/table/fixed.jsx | 8 +++++--- src/table/lock.jsx | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/table/fixed.jsx b/src/table/fixed.jsx index 783bc0988a..d6b0f8239e 100644 --- a/src/table/fixed.jsx +++ b/src/table/fixed.jsx @@ -70,14 +70,16 @@ export default function fixed(BaseComponent) { } adjustFixedHeaderSize() { - const { hasHeader, fixedHeader, maxBodyHeight } = this.props; + const { hasHeader, fixedHeader, maxBodyHeight, rtl } = this.props; + const paddingName = rtl ? 'paddingLeft' : 'paddingRight'; + if (hasHeader && fixedHeader && !this.props.lockType) { if (this.bodyNode.scrollHeight <= maxBodyHeight) { - dom.setStyle(this.headerNode, 'paddingRight', 0); + dom.setStyle(this.headerNode, paddingName, 0); } else { dom.setStyle( this.headerNode, - 'paddingRight', + paddingName, dom.scrollbar().width ); } diff --git a/src/table/lock.jsx b/src/table/lock.jsx index aaa9fcbff9..4b4167d386 100644 --- a/src/table/lock.jsx +++ b/src/table/lock.jsx @@ -441,7 +441,7 @@ export default function lock(BaseComponent) { dom.setStyle( lockRightBodyWrapper, rtl ? 'left' : 'right', - width + `${width}px` ); } }