From 4e695bb10f7eb7b0255685275d5650dfed048367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E7=81=8F?= Date: Wed, 8 Sep 2021 21:48:11 +0800 Subject: [PATCH] Table add props: fixed-shadow --- src/components/table/table.vue | 44 +++++++++++++++++++++++++++++--- src/styles/components/table.less | 6 ++++- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/src/components/table/table.vue b/src/components/table/table.vue index ef6ccf71..1ac90c47 100644 --- a/src/components/table/table.vue +++ b/src/components/table/table.vue @@ -48,7 +48,7 @@ -
+
-
+
cell._width).reduce((a, b) => a + b, 0) + (this.showVerticalScrollBar?this.scrollBarWidth:0) + 1; this.columnsWidth = columnsWidth; this.fixedHeader(); + + // 4.7.0 auto fixed shadow + if (this.fixedShadow === 'auto') { + this.$nextTick(() => { + const $body = this.$refs.body; + this.scrollOnTheLeft = $body.scrollLeft === 0; + this.scrollOnTheRight = $body.scrollWidth === $body.scrollLeft + $body.clientWidth; + }); + } }, handleMouseIn (_index, rowKey) { if (this.disabledHover) return; @@ -1036,6 +1070,10 @@ this.cloneColumns.forEach((col) => col._filterVisible = false); }, handleBodyScroll (event) { + // 4.7.0 + this.scrollOnTheLeft = event.target.scrollLeft === 0; + this.scrollOnTheRight = event.target.scrollWidth === event.target.scrollLeft + event.target.clientWidth; + if (this.showHeader) this.$refs.header.scrollLeft = event.target.scrollLeft; if (this.isLeftFixed) this.$refs.fixedBody.scrollTop = event.target.scrollTop; if (this.isRightFixed) this.$refs.fixedRightBody.scrollTop = event.target.scrollTop; diff --git a/src/styles/components/table.less b/src/styles/components/table.less index 5f3597bb..77e217a9 100644 --- a/src/styles/components/table.less +++ b/src/styles/components/table.less @@ -389,7 +389,6 @@ position: absolute; top: 0; left: 0; - box-shadow: 2px 0 6px -2px rgba(0, 0, 0, 0.2); &::before { content: ''; @@ -406,6 +405,11 @@ top: 0; left: auto; right: 0; + } + &-fixed&-fixed-shadow{ + box-shadow: 2px 0 6px -2px rgba(0, 0, 0, 0.2); + } + &-fixed-right&-fixed-shadow{ box-shadow: -2px 0 6px -2px rgba(0, 0, 0, 0.2); } &-fixed-right-header{