我在下面这样的引导卡中使用ngx-swiper-wrapper,顶部有一个 routerlink。因此,如果我单击卡上的任何位置,它将路由。工作正常!但是,如果我在任何滑动图像上滑动/单击左/右,我想停止路由传播。我可以捕捉到事件,但似乎无法弄清楚如何停止事件方法内的传播。
任何帮助,将不胜感激。一个问题是'onIndexChange()',$event 只是索引号,所以我不能从那个开始工作,与 onSwiperEvent() 一样,我传入的 $event 是一个空数组。
仅供参考 - 我在下面都试过了,但都没有运气。都没有停止路由
preventClicksPropagation: true,
touchMoveStopPropagation: true
<div class="card" [routerLink]="['/events', event.id]">
<swiper [config]="eventsSwiperConfig" [(index)]="index" (indexChange)="onIndexChange($event)" (swiperTransitionStart)="onSwiperEvent($event)"></swiper>
<ng-container *ngFor="let photo of event.photoUrl">
<div class="outer-img-container">
<div class="img-container">
<img class="card-img swiper-lazy" src="{{photo}}">
<div class="swiper-lazy-preloader swiper-lazy-preloader-white"></div>
</div>
</div>
</ng-container>
<div class="card-body">
<h5 class="card-title">Card title</h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
</div>