mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 13:32:54 +08:00
@ -6,13 +6,18 @@ import {ionicBootstrap} from '../../../../../src';
|
|||||||
templateUrl: 'main.html'
|
templateUrl: 'main.html'
|
||||||
})
|
})
|
||||||
class E2EPage {
|
class E2EPage {
|
||||||
items = [];
|
items: any[] = [];
|
||||||
|
|
||||||
@ViewChild('content') content: ElementRef;
|
@ViewChild('content') content: ElementRef;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
for (var i = 0; i < 200; i++) {
|
for (var i = 0; i < 200; i++) {
|
||||||
this.items.push(i);
|
this.items.push({
|
||||||
|
value: i,
|
||||||
|
someMethod: function() {
|
||||||
|
return `!!`
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
</ion-item-divider>
|
</ion-item-divider>
|
||||||
|
|
||||||
<ion-item *virtualItem="let item">
|
<ion-item *virtualItem="let item">
|
||||||
Item: {{item}}
|
Item: {{item.value}} {{item.someMethod()}}
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|
||||||
</ion-list>
|
</ion-list>
|
||||||
|
@ -436,7 +436,7 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy {
|
|||||||
this._ftrTmp && this._ftrTmp.templateRef, true);
|
this._ftrTmp && this._ftrTmp.templateRef, true);
|
||||||
|
|
||||||
// ******** DOM WRITE ****************
|
// ******** DOM WRITE ****************
|
||||||
this._cd.detectChanges();
|
this.detectChanges();
|
||||||
|
|
||||||
// wait a frame before trying to read and calculate the dimensions
|
// wait a frame before trying to read and calculate the dimensions
|
||||||
nativeRaf(this.postRenderVirtual.bind(this));
|
nativeRaf(this.postRenderVirtual.bind(this));
|
||||||
@ -473,14 +473,7 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy {
|
|||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
scrollUpdate() {
|
detectChanges() {
|
||||||
clearNativeTimeout(this._tmId);
|
|
||||||
this._tmId = nativeTimeout(this.onScrollEnd.bind(this), SCROLL_END_TIMEOUT_MS);
|
|
||||||
|
|
||||||
let data = this._data;
|
|
||||||
|
|
||||||
if (this._queue === QUEUE_CHANGE_DETECTION) {
|
|
||||||
// ******** DOM WRITE ****************
|
|
||||||
let node: VirtualNode;
|
let node: VirtualNode;
|
||||||
for (var i = 0; i < this._nodes.length; i++) {
|
for (var i = 0; i < this._nodes.length; i++) {
|
||||||
node = this._nodes[i];
|
node = this._nodes[i];
|
||||||
@ -489,6 +482,20 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy {
|
|||||||
node.hasChanges = false;
|
node.hasChanges = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
scrollUpdate() {
|
||||||
|
clearNativeTimeout(this._tmId);
|
||||||
|
this._tmId = nativeTimeout(this.onScrollEnd.bind(this), SCROLL_END_TIMEOUT_MS);
|
||||||
|
|
||||||
|
let data = this._data;
|
||||||
|
|
||||||
|
if (this._queue === QUEUE_CHANGE_DETECTION) {
|
||||||
|
// ******** DOM WRITE ****************
|
||||||
|
this.detectChanges();
|
||||||
|
|
||||||
if (this._eventAssist) {
|
if (this._eventAssist) {
|
||||||
// queue updating node positions in the next frame
|
// queue updating node positions in the next frame
|
||||||
@ -573,7 +580,7 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy {
|
|||||||
adjustRendered(this._cells, this._data);
|
adjustRendered(this._cells, this._data);
|
||||||
|
|
||||||
// ******** DOM WRITE ****************
|
// ******** DOM WRITE ****************
|
||||||
this._cd.detectChanges();
|
this.detectChanges();
|
||||||
|
|
||||||
// ******** DOM WRITE ****************
|
// ******** DOM WRITE ****************
|
||||||
this.setVirtualHeight(
|
this.setVirtualHeight(
|
||||||
|
Reference in New Issue
Block a user