Skip to content

Commit 2f72b32

Browse files
committed
remove customOption
1 parent 9c8e563 commit 2f72b32

File tree

1 file changed

+17
-25
lines changed

1 file changed

+17
-25
lines changed

packages/ve-table/src/index.jsx

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,12 @@ export default {
259259
defaultVirtualScrollMinRowHeight: 40,
260260
// default placeholder per scrolling row count
261261
defaultPlaceholderPerScrollingRowCount: 8,
262+
//起始索引
263+
virtualScrollStartIndex: 0,
264+
// preview virtual scroll start index
265+
previewVirtualScrollStartIndex: 0,
266+
//结束索引
267+
virtualScrollEndIndex: 0,
262268
// is scrolling
263269
showVirtualScrollingPlaceholder: false,
264270
// disable pointer events timeout id
@@ -308,15 +314,6 @@ export default {
308314
enableStopEditing: true,
309315
};
310316
},
311-
// 存储非响应式数据
312-
customOption: {
313-
//起始索引
314-
virtualScrollStartIndex: 0,
315-
// preview virtual scroll start index
316-
previewVirtualScrollStartIndex: 0,
317-
//结束索引
318-
virtualScrollEndIndex: 0,
319-
},
320317
computed: {
321318
// actual render table data
322319
actualRenderTableData() {
@@ -1044,9 +1041,8 @@ export default {
10441041
setVirtualScrollVisibleData() {
10451042
const { tableData } = this;
10461043

1047-
const startIndex =
1048-
this.$options.customOption.virtualScrollStartIndex;
1049-
const endIndex = this.$options.customOption.virtualScrollEndIndex;
1044+
const startIndex = this.virtualScrollStartIndex;
1045+
const endIndex = this.virtualScrollEndIndex;
10501046

10511047
const aboveCount = this.getVirtualScrollAboveCount();
10521048
const belowCount = this.getVirtualScrollBelowCount();
@@ -1062,8 +1058,7 @@ export default {
10621058
let result = 0;
10631059
const { isVirtualScroll, defaultVirtualScrollBufferCount } = this;
10641060

1065-
const virtualScrollStartIndex =
1066-
this.$options.customOption.virtualScrollStartIndex;
1061+
const virtualScrollStartIndex = this.virtualScrollStartIndex;
10671062

10681063
if (isVirtualScroll) {
10691064
result = Math.min(
@@ -1084,8 +1079,7 @@ export default {
10841079
defaultVirtualScrollBufferCount,
10851080
} = this;
10861081

1087-
const virtualScrollEndIndex =
1088-
this.$options.customOption.virtualScrollEndIndex;
1082+
const virtualScrollEndIndex = this.virtualScrollEndIndex;
10891083

10901084
if (isVirtualScroll) {
10911085
result = Math.min(
@@ -1210,7 +1204,7 @@ export default {
12101204
},
12111205
// set virtual scroll start offset
12121206
setVirtualScrollStartOffset() {
1213-
const start = this.$options.customOption.virtualScrollStartIndex;
1207+
const start = this.virtualScrollStartIndex;
12141208

12151209
const aboveCount = this.getVirtualScrollAboveCount();
12161210

@@ -1275,12 +1269,11 @@ export default {
12751269

12761270
//此时的开始索引
12771271
let visibleStartIndex = this.getVirtualScrollStartIndex(scrollTop);
1278-
this.$options.customOption.virtualScrollStartIndex =
1279-
visibleStartIndex;
1272+
this.virtualScrollStartIndex = visibleStartIndex;
12801273

12811274
//此时的结束索引
12821275
let visibleEndIndex = visibleStartIndex + visibleCount;
1283-
this.$options.customOption.virtualScrollEndIndex = visibleEndIndex;
1276+
this.virtualScrollEndIndex = visibleEndIndex;
12841277

12851278
const visibleAboveCount = this.getVirtualScrollAboveCount();
12861279
const visibleBelowCount = this.getVirtualScrollBelowCount();
@@ -1344,8 +1337,8 @@ export default {
13441337
if (this.isVirtualScroll) {
13451338
const startIndex = 0;
13461339

1347-
this.$options.customOption.virtualScrollStartIndex = startIndex;
1348-
this.$options.customOption.virtualScrollEndIndex =
1340+
this.virtualScrollStartIndex = startIndex;
1341+
this.virtualScrollEndIndex =
13491342
startIndex + this.virtualScrollVisibleCount;
13501343

13511344
const tableContainerRef = this.$refs[this.tableContainerRef];
@@ -2012,12 +2005,11 @@ export default {
20122005
const {
20132006
virtualScrollStartIndex: startIndex,
20142007
previewVirtualScrollStartIndex: previewStartIndex,
2015-
} = this.$options.customOption;
2008+
} = this;
20162009

20172010
const differ = Math.abs(startIndex - previewStartIndex);
20182011

2019-
this.$options.customOption.previewVirtualScrollStartIndex =
2020-
startIndex;
2012+
this.previewVirtualScrollStartIndex = startIndex;
20212013

20222014
// default placeholder per scrolling row count
20232015
if (

0 commit comments

Comments
 (0)