首页 文章

角度5 reInit猫头鹰旋转木马

提问于
浏览
0

我可以在哪里运行函数reInit()ngx-owl-carousel?

我使用ngx-owl-carousel模块,并使用angular 5,

如果路线改变owl- carousel被制动

<owl-carousel  #OwlElement class="col-12 col-xs-6 top-15"
             [options]="{
                items: 1,
                autoplay: true,
                autoplayTimeout: 5000,
                loop: true,
                margin:0,
                mouseDrag: true,
                singleItem: true,
                nav:false,
                dotClass: 'dots',
                dotsClass: 'dots-record',
                dots: true,   
                smartSpeed:1000,
                navSpeed: 1000
              }"
             [items]="[record_img]"
             [carouselClasses]="['owl-theme', 'row', 'sliding']">

1 回答

  • 0

    在您的组件中:

    @ViewChild('OwlElement') OwlElement: OwlCarousel 
    
    yourMethod() {
        this.OwlElement.reInit();
    }
    

相关问题