我尝试了这段代码,但是当我从代码虚拟滚动中删除class="gridGallery"
,class="gridGallery-item"
时工作正常,但是砌体库停止工作。
廊-custom.html
<ion-list class="gridGallery" [virtualScroll]="itemsss" approxItemHeight="100px">
<ion-card class="gridGallery-item" *virtualItem="let item">
<img src={{item.avatarUrl}}>
</ion-card>
</ion-list>
廊-custom.ts
ionViewDidEnter() {
setTimeout(() => {
let elem = document.querySelector('.gridGallery');
let msnry = new Masonry(elem, {
itemSelector: '.gridGallery-item',
columnWidth: '.gridGallery-item',
gutter: 0,
fitWidth: true,
horizontalOrder: false,
resize: true
});
console.log(msnry);
}, 100);
}