mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
@ -20,6 +20,10 @@
|
||||
<ion-button onclick="addItems()">Add Items</ion-button>
|
||||
</ion-buttons>
|
||||
</ion-toolbar>
|
||||
<ion-toolbar></ion-toolbar>
|
||||
<ion-toolbar></ion-toolbar>
|
||||
<ion-toolbar></ion-toolbar>
|
||||
<ion-toolbar></ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
|
@ -11,6 +11,7 @@ import { Range, calcCells, calcHeightIndex, doRender, findCellIndex, getRange, g
|
||||
})
|
||||
export class VirtualScroll {
|
||||
|
||||
private contentEl?: HTMLElement;
|
||||
private scrollEl?: HTMLElement;
|
||||
private range: Range = { offset: 0, length: 0 };
|
||||
private timerUpdate: any;
|
||||
@ -121,6 +122,7 @@ export class VirtualScroll {
|
||||
}
|
||||
await contentEl.componentOnReady();
|
||||
|
||||
this.contentEl = contentEl;
|
||||
this.scrollEl = contentEl.getScrollElement();
|
||||
this.calcCells();
|
||||
this.updateState();
|
||||
@ -215,14 +217,15 @@ export class VirtualScroll {
|
||||
}
|
||||
|
||||
private readVS() {
|
||||
const { scrollEl, el } = this;
|
||||
const { contentEl, scrollEl, el } = this;
|
||||
let topOffset = 0;
|
||||
let node: HTMLElement | null = el;
|
||||
while (node && node !== scrollEl) {
|
||||
while (node && node !== contentEl) {
|
||||
topOffset += node.offsetTop;
|
||||
node = node.parentElement;
|
||||
}
|
||||
this.viewportOffset = topOffset;
|
||||
console.log(this.viewportOffset);
|
||||
if (scrollEl) {
|
||||
this.viewportHeight = scrollEl.offsetHeight;
|
||||
this.currentScrollTop = scrollEl.scrollTop;
|
||||
|
Reference in New Issue
Block a user