1

我使用离子幻灯片如下:

<div *ngFor="let category of categories">
    <h6 class="slide-title" [innerHTML]="category.name"></h6>
    <ion-slides [loop]="true" [pager]="true" [slidesPerView]="3">
        <ion-slide *ngFor="let product of category.products">
            <img [src]="product.image" class="slide-image">
        </ion-slide>
    </ion-slides>
</div>

我收到以下错误:

未处理的承诺拒绝:模板解析错误:无法绑定到“slidesPerView”,因为它不是“离子幻灯片”的已知属性。

  1. 如果 'ion-slides' 是一个 Angular 组件并且它有 'slidesPerView' 输入,那么验证它是这个模块的一部分。
  2. 如果“ion-slides”是一个 Web 组件,则将“CUSTOM_ELEMENTS_SCHEMA”添加到该组件的“@NgModule.schemas”以禁止显示此消息。("h6 class="slide-title" [innerHTML]="category.name"> ][slidesPerView]="3">

<img [src]="product"): MainPage@12:43 ; 区域:; 任务:Promise.then;价值: ....

任何人都可以帮忙吗?

离子-v 2.2.1

科尔多瓦-v 6.5.0

4

1 回答 1

5

最近离子载玻片发生了一些变化。确保您拥有最新的 ionic 版本 (2.0.0)。您也可以使用 slidesPerView 而无需将其括在方括号中,如下所示

<ion-slides pager loop slidesPerView="3">
  <ion-slide>
     ...
  </ion-slide>
<ion-slides>
于 2017-02-01T05:19:10.613 回答