如何在Owl Carousel(2)中实现角度为2/7的onChange事件/回调/自定义点

我需要在更改猫头鹰旋转木马幻灯片时调用角度7 函数,我想为幻灯片设计一个自定义点。谁能帮助我。.

我在下面引用了文档

https://www.npmjs.com/package/ngx-owl-carousel

https://owlcarousel2.github.io/OwlCarousel2/docs/api-events.html

<owl-carousel #owlElement [options]="sliderOptions" [carouselClasses]="['owl-theme','sliding']"></owl-carousel>


@ViewChild('owlElement',{ static: false }) owlElement: OwlCarousel;

self = this;
sliderOptions = {
  items: 1,dots: true,nav: false,navText: ["<i class='fa fa-angle-left'></i>","<i class='fa fa-angle-right'></i>"],onChange: function () {
    console.log("change");
    self.changeCustomDots();
 }
};

ngOnInit() {}

changeCustomDots() {
  console.log("change custom dots styles here..");
}
yufen0312 回答:如何在Owl Carousel(2)中实现角度为2/7的onChange事件/回调/自定义点

每个由函数语句创建的新函数,均基于该函数的调用方式定义其自己的 this 值。因此使用arrow函数将引用当前对象

sliderOptions = {
  items: 1,dots: true,nav: false,navText: ["<i class='fa fa-angle-left'></i>","<i class='fa fa-angle-right'></i>"],onChange: () => {
    console.log("change");
    this.changeCustomDots();
 }
};
本文链接:https://www.f2er.com/2863892.html

大家都在问