afterchange函数中的ngx-slick-carousel如何传递数据

时间:2019-07-01 07:12:39

标签: angular

更改幻灯片后我想要当前幻灯片数据

我试图在afterchange方法中传递事件,但是方法中没有数据

<ngx-slick-carousel class="carousel" (afterChange)="afterChange($event,asset)" #slickModal="slick-carousel" [config]="slideConfig">
  <div ngxSlickItem style="display: flex; flex-direction: column;" *ngFor="let asset of (design.product|async)?.assets; let i = index">
    <div class="p-grid p-align-center p-justify-center">
      <div class="p-col-10 text-center" style="width:215px; height:200px;display: flex;align-items: center">
        <img *ngIf="asset && asset.asset" src="{{
              this.apiUrl +
                '/assets/' +
                asset.asset._id +
                '/' +
                asset.asset._id +
                '.jpg' 
            }}" alt="" width="100%" style="max-height: 190px" />
      </div>
      <div class="p-col-10 text-left">
        <div class="vertical-bottom">
          <p class="md-body dark-grey">{{asset.asset?.name}}</p>
          <p class="md-head thick">${{asset.asset?.price.customer}}</p>
        </div>
      </div>
    </div>
  </div>
</ngx-slick-carousel>

在组件中

afterChange(event, asset) {
  console.log('working', event.slick, asset);
}

当前幻灯片数据

0 个答案:

没有答案