Skip to content

Commit 10ef3f1

Browse files
committed
bug fixed
1、修复表格高度多出2px的问题
1 parent 913d64b commit 10ef3f1

22 files changed

+32
-35
lines changed

packages/ve-table/src/index.jsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ export default {
271271
hasXScrollBar: false,
272272
// has vertical scroll bar
273273
hasYScrollBar: false,
274+
// scroll bar width
275+
scrollBarWidth: 0,
274276
// cell selection key
275277
cellSelectionKeyData: {
276278
rowKey: "",
@@ -314,8 +316,6 @@ export default {
314316
virtualScrollEndIndex: 0,
315317
// preview table container scrollLeft (处理左列或右列固定效果)
316318
previewTableContainerScrollLeft: null,
317-
// scroll bar width
318-
scrollBarWidth: 0,
319319
},
320320
computed: {
321321
// actual render table data
@@ -386,11 +386,6 @@ export default {
386386

387387
tableContainerHeight = tableHeight;
388388

389-
// border around
390-
if (this.borderAround) {
391-
tableContainerHeight += 2;
392-
}
393-
394389
/*
395390
有横向滚动条时,表格高度需要加上滚动条的宽度
396391
When there is a horizontal scroll bar, the table height needs to be added with the width of the scroll bar
@@ -637,11 +632,13 @@ export default {
637632
getScrollBarWidth() {
638633
let result = 0;
639634

640-
if (this.$options.customOption.scrollBarWdith) {
641-
result = this.$options.customOption.scrollBarWdith;
635+
const { scrollBarWidth } = this;
636+
637+
if (scrollBarWidth) {
638+
result = scrollBarWidth;
642639
} else {
643640
result = getScrollbarWidth();
644-
this.$options.customOption.scrollBarWdith = result;
641+
this.scrollBarWidth = result;
645642
}
646643

647644
return result;

tests/unit/specs/__snapshots__/ve-table-border.spec.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`veTable border renders border default 1`] = `
44
<div class="ve-table ve-table-border-around">
5-
<div class="ve-table-container" style="height: 2px;">
5+
<div class="ve-table-container" style="height: 0px;">
66
<table class="ve-table-content ve-table-border-x">
77
<colgroup>
88
<col>

tests/unit/specs/__snapshots__/ve-table-cell-align.spec.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`veTable cell align render 1`] = `
44
<div class="ve-table ve-table-border-around">
5-
<div class="ve-table-container" style="height: 2px;">
5+
<div class="ve-table-container" style="height: 0px;">
66
<table class="ve-table-content ve-table-border-x">
77
<colgroup>
88
<col>

tests/unit/specs/__snapshots__/ve-table-cell-custom.spec.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`veTable cell custom render 1`] = `
44
<div class="ve-table ve-table-border-around">
5-
<div class="ve-table-container" style="height: 2px;">
5+
<div class="ve-table-container" style="height: 0px;">
66
<table class="ve-table-content ve-table-border-x">
77
<colgroup>
88
<col>

tests/unit/specs/__snapshots__/ve-table-cell-edit.spec.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`veTable cell edit cell editor render 1`] = `
44
<div class="ve-table ve-table-border-around">
5-
<div class="ve-table-container" style="height: 2px;">
5+
<div class="ve-table-container" style="height: 0px;">
66
<table class="ve-table-content ve-table-border-x">
77
<colgroup>
88
<col style="width: 15%;">

tests/unit/specs/__snapshots__/ve-table-cell-ellipsis.spec.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`veTable cell ellipsis render single line ellipsis 1`] = `
44
<div class="ve-table ve-table-border-around">
5-
<div class="ve-table-container" style="height: 2px;">
5+
<div class="ve-table-container" style="height: 0px;">
66
<table class="ve-table-content ve-table-border-x">
77
<colgroup>
88
<col style="width: 15%;">

tests/unit/specs/__snapshots__/ve-table-cell-selection.spec.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`veTable cell selection render 1`] = `
44
<div class="ve-table ve-table-border-around">
5-
<div class="ve-table-container" style="height: 2px;">
5+
<div class="ve-table-container" style="height: 0px;">
66
<table class="ve-table-content ve-table-border-x">
77
<colgroup>
88
<col style="width: 20%;">

tests/unit/specs/__snapshots__/ve-table-cell-span.spec.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`veTable cell span render 1`] = `
44
<div class="ve-table ve-table-border-around">
5-
<div class="ve-table-container" style="height: 2px;">
5+
<div class="ve-table-container" style="height: 0px;">
66
<table class="ve-table-content ve-table-border-x">
77
<colgroup>
88
<col style="width: 200px;">

tests/unit/specs/__snapshots__/ve-table-cell-style.spec.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`veTable cell style render 1`] = `
44
<div class="ve-table ve-table-border-around">
5-
<div class="ve-table-container" style="height: 2px;">
5+
<div class="ve-table-container" style="height: 0px;">
66
<table class="ve-table-content ve-table-border-x">
77
<colgroup>
88
<col>

tests/unit/specs/__snapshots__/ve-table-column-fixed.spec.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`veTable column fixed renders normal 1`] = `
44
<div class="ve-table ve-table-border-around">
5-
<div class="ve-table-container" style="height: 2px;">
5+
<div class="ve-table-container" style="height: 0px;">
66
<table class="ve-table-content ve-table-border-x">
77
<colgroup>
88
<col>

0 commit comments

Comments
 (0)