【发布时间】:2021-06-24 07:54:38
【问题描述】:
我正在使用带角度的 swiperjs (v 12),我想为每张幻灯片设置特定的延迟。 我已经从“swiper/core”导入了 {Autoplay} 并调用了 SwiperCore.use([Autoplay]) 方法。 如果我为所有幻灯片设置延迟,它工作正常:
// .ts component
import SwiperCore, { Autoplay } from 'swiper'
SwiperCore.use([Autoplay])
autoplay: AutoplayOptions | boolean = {
delay: 3000,
disableOnInteraction: false
}
// .Html
<swiper
#swiperSlideShow
[slidesPerView]="1"
[spaceBetween]="50"
(swiper)="onSwiper($event)"
(slideChange)="onSlideChange()"
[loop]="true"
[autoplay]="true"
[effect]="'coverflow'"
[coverflowEffect]="coverflowEffect"
[parallax]="true"
[keyboard] = "keyboard"
[speed]="1800"
>
<ng-template swiperSlide >
<div >
<app-slide-three></app-slide-three>
</div>
<div >
<app-slide-ex></app-slide-ex>
</div>
<div >
<app-slide-dy></app-slide-dy>
</div>
</ng-template>
但“data-swiper-autoplay”被忽略,<ng-template swiperSlide data-swiper-autoplay="5000" > 保留默认值延迟(3000),我不知道是否有特定的 Angular 方法可以将此延迟分配给单个幻灯片,在文档中是未指定..
【问题讨论】: