首页 > 解决方案 > ion-virtual-scroll 不是已知元素

问题描述

<ion-virtual-scroll [items]="churchNewsList" approxItemHeight="120px">
        <ion-item *virtualItem="let news">
          {{ news }}
        </ion-item>
</ion-virtual-scroll>

我收到此错误

Can't bind to 'items' since it isn't a known property of 'ion-virtual-scroll'.
1. If 'ion-virtual-scroll' is an Angular component and it has 'items' input, then verify that it is part of this module.
2. If 'ion-virtual-scroll' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

如前所述,如何将其包含在 NgModule 中。官方文档没有这样说。

标签: angularionic3

解决方案


我有类似的问题,但是我发现的搜索ion-scroll不再存在,div可以改用

以上css可以实现如下

div[scrollx=true],div[scrolly=true] {
  position: relative;
  overflow: hidden;
}

div[scrollx=true] {
  overflow-x: auto;
}

div[scrolly=true] {
  overflow-y: auto;
}

解决方案来自Ionic Team你在这里看到的


推荐阅读