Angular 爱奥尼亚4无限卷轴只工作一次
我看到过其他关于这个问题的帖子,但似乎没有指出我的问题是什么。我没有看到任何错误的控制台等和行为是相同的浏览器以及手机 代码如下。它在第一次运行时确实按照预期工作,并加载另外5个对象。但我看它不会再被解雇了Angular 爱奥尼亚4无限卷轴只工作一次,angular,ionic-framework,ionic4,infinite-scroll,Angular,Ionic Framework,Ionic4,Infinite Scroll,我看到过其他关于这个问题的帖子,但似乎没有指出我的问题是什么。我没有看到任何错误的控制台等和行为是相同的浏览器以及手机 代码如下。它在第一次运行时确实按照预期工作,并加载另外5个对象。但我看它不会再被解雇了 <ion-content fullscreen> <div class="full-screen-bg"> <div style="background-color: #181828;padding:10px">
<ion-content fullscreen>
<div class="full-screen-bg">
<div style="background-color: #181828;padding:10px">
<ion-row *ngFor="let gal of core.gallery; let i=index">
<ion-col *ngIf="i%2 == 0 && core.gallery[i] != undefined" class="ion-text-center ion-padding" style="padding-top:0px !important">
<img *ngIf="core.gallery[i].type == 'image'" src="{{core.gallery[i].link}}" (click)="zoomImage(i)">
<iframe *ngIf="core.gallery[i].type == 'video'" style="width: 100%" [src]="getVideoUrl(core.gallery[i].link)" frameborder="0" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</ion-col>
<ion-col *ngIf="i%2 == 0 && core.gallery[i+1] != undefined" style="padding-left:0px !important;padding-top:0px !important" class="ion-text-center ion-padding">
<img *ngIf="core.gallery[i+1].type == 'image'" src="{{core.gallery[i+1].link}}" (click)="zoomImage(i+1)">
<iframe *ngIf="core.gallery[i+1].type == 'video'" style="width: 100%" [src]="getVideoUrl(core.gallery[i+1].link)" frameborder="0" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</ion-col>
</ion-row>
</div>
</div>
<ion-infinite-scroll #infiniteScroll (ionInfinite)="loadData($event)">
<ion-infinite-scroll-content
loadingSpinner="bubbles"
loadingText="Loading more data...">
</ion-infinite-scroll-content>
</ion-infinite-scroll>
</ion-content>
我开发的一个页面也出现了同样的问题。
在评论“overflow-y:scroll;”
之后,我在scss中为同一组件创建了以下样式 它开始运作良好。这很奇怪。我花了3个小时才弄明白:)
确保它是
event.target.complete()
而不是event.complete()
?是的,根据这一点,就是event.target.complete(),您确切拥有哪个版本?4.11.7“@ionic/angular”:“^4.7.2”,问题已经存在很长时间了,
import { IonInfiniteScroll } from '@ionic/angular';
....
@ViewChild(IonInfiniteScroll) infiniteScroll: IonInfiniteScroll;
loadData(event) {
setTimeout(async() => {
let resp = await this.sgSvc.getGalleryPaged(this.anchorKey)
console.log("new anchor key:" + JSON.stringify(resp[0].key))
this.anchorKey = resp[0].key
var galleryKeys = Object.keys(resp)
for(let galleryKey of galleryKeys){
var galleryObj = resp[galleryKey]
//console.log(galleryObj._name + " " + galleryObj._link)
if(this.showPhotos == false && galleryObj._type == 'image')
continue
if(this.showVideos == false && galleryObj._type == 'video')
continue
var glry:Gallery = new Gallery(galleryKey, galleryObj._name, galleryObj._type, galleryObj._link, galleryObj._date, galleryObj._desc)
this.core.gallery.push(glry)
}
console.log('Done');
event.target.complete();
}, 500);
}
ion-grid,
ion-row {
height: 100%;
overflow-y: scroll;
}