Skip to content

Commit 03b589c

Browse files
committed
remove customOption
1 parent 2f72b32 commit 03b589c

File tree

1 file changed

+21
-28
lines changed

1 file changed

+21
-28
lines changed

packages/ve-table/src/body/index.jsx

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -149,19 +149,16 @@ export default {
149149
1、存储当前单选功能的rowkey 信息
150150
*/
151151
internalRadioSelectedRowKey: null,
152+
// cols widths efficient count
153+
colsWidthsEfficientCount: 0,
154+
// has init columns widths 此属性可优化固定列表格初始化渲染慢问题
155+
hasPreparedColsWidths: false,
156+
// virtual scroll preview rendered rowKey
157+
virtualScrollPreviewRenderedRowKeys: [],
158+
// virtual scroll repeat rendered rowKey
159+
virtualScrollRepeatRenderedRowKeys: [],
152160
};
153161
},
154-
// 存储非响应式数据
155-
customOption: {
156-
// cols widths efficient count
157-
colsWidthsEfficientCount: 0,
158-
// has init columns widths 此属性可优化固定列表格初始化渲染慢问题
159-
hasPreparedColsWidths: false,
160-
// virtual scroll preview rendered rowKey
161-
virtualScrollPreviewRenderedRowKeys: [],
162-
// virtual scroll repeat rendered rowKey
163-
virtualScrollRepeatRenderedRowKeys: [],
164-
},
165162
computed: {
166163
/*
167164
column collenction info
@@ -555,24 +552,21 @@ export default {
555552
colsWidths.set(key, width);
556553

557554
// 优化固定列表格初始化渲染速度慢问题
558-
if (!this.$options.customOption.hasPreparedColsWidths) {
559-
if (
560-
++this.$options.customOption
561-
.colsWidthsEfficientCount === colgroups.length
562-
) {
563-
this.$options.customOption.hasPreparedColsWidths = true;
555+
if (!this.hasPreparedColsWidths) {
556+
if (++this.colsWidthsEfficientCount === colgroups.length) {
557+
this.hasPreparedColsWidths = true;
564558
}
565559
}
566-
if (this.$options.customOption.hasPreparedColsWidths) {
560+
if (this.hasPreparedColsWidths) {
567561
this.$emit(EMIT_EVENTS.BODY_TD_WIDTH_CHANGE, colsWidths);
568562
}
569563
}
570564
},
571565

572566
// reset prepared column widths status
573567
resetPreparedColsWidthsStatus() {
574-
this.$options.customOption.colsWidthsEfficientCount = 0;
575-
this.$options.customOption.hasPreparedColsWidths = false;
568+
this.colsWidthsEfficientCount = 0;
569+
this.hasPreparedColsWidths = false;
576570
},
577571

578572
// init internal expand row keys
@@ -812,15 +806,15 @@ export default {
812806
renderingRowKeys(rowKeys) {
813807
const {
814808
virtualScrollPreviewRenderedRowKeys: previewRenderedRowKeys,
815-
} = this.$options.customOption;
809+
} = this;
816810

817-
this.$options.customOption.virtualScrollRepeatRenderedRowKeys =
818-
rowKeys.filter((rowKey) => {
811+
this.virtualScrollRepeatRenderedRowKeys = rowKeys.filter(
812+
(rowKey) => {
819813
return previewRenderedRowKeys.indexOf(rowKey) != -1;
820-
});
814+
},
815+
);
821816

822-
this.$options.customOption.virtualScrollPreviewRenderedRowKeys =
823-
rowKeys;
817+
this.virtualScrollPreviewRenderedRowKeys = rowKeys;
824818
},
825819
},
826820
mounted() {
@@ -878,8 +872,7 @@ export default {
878872
showVirtualScrollingPlaceholder,
879873
} = this;
880874

881-
const { virtualScrollRepeatRenderedRowKeys } =
882-
this.$options.customOption;
875+
const { virtualScrollRepeatRenderedRowKeys } = this;
883876

884877
return (
885878
<tbody>

0 commit comments

Comments
 (0)