mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 13:32:54 +08:00
fix(virtual-scroll): remove duplicate items
This commit is contained in:
@ -229,12 +229,12 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy {
|
|||||||
_nodes: VirtualNode[] = [];
|
_nodes: VirtualNode[] = [];
|
||||||
_vHeight: number = 0;
|
_vHeight: number = 0;
|
||||||
_lastCheck: number = 0;
|
_lastCheck: number = 0;
|
||||||
|
_recordSize: number = 0;
|
||||||
_data: VirtualData = {
|
_data: VirtualData = {
|
||||||
scrollTop: 0,
|
scrollTop: 0,
|
||||||
};
|
};
|
||||||
_queue: number = SCROLL_QUEUE_NO_CHANGES;
|
_queue: number = SCROLL_QUEUE_NO_CHANGES;
|
||||||
|
|
||||||
|
|
||||||
_virtualTrackBy: TrackByFn;
|
_virtualTrackBy: TrackByFn;
|
||||||
|
|
||||||
@ContentChild(VirtualItem) _itmTmp: VirtualItem;
|
@ContentChild(VirtualItem) _itmTmp: VirtualItem;
|
||||||
@ -445,7 +445,7 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy {
|
|||||||
|
|
||||||
let needClean = false;
|
let needClean = false;
|
||||||
if (changes) {
|
if (changes) {
|
||||||
var lastRecord = this.lastRecord() + 1;
|
var lastRecord = this._recordSize;
|
||||||
|
|
||||||
changes.forEachOperation((_, pindex, cindex) => {
|
changes.forEachOperation((_, pindex, cindex) => {
|
||||||
|
|
||||||
@ -465,6 +465,7 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy {
|
|||||||
} else {
|
} else {
|
||||||
needClean = true;
|
needClean = true;
|
||||||
}
|
}
|
||||||
|
this._recordSize = this._records.length;
|
||||||
|
|
||||||
this.readUpdate(needClean);
|
this.readUpdate(needClean);
|
||||||
this.writeUpdate(needClean);
|
this.writeUpdate(needClean);
|
||||||
|
Reference in New Issue
Block a user