Ionic 2虚拟滚动与砖石级联网格布局库

时间:2017-05-11 11:22:55

标签: angular typescript ionic2 masonry

我尝试了这段代码,但是当我从代码虚拟滚动中删除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);
  }

0 个答案:

没有答案