我可以在哪里运行函数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']">
答案 0 :(得分:1)
在您的组件中:
@ViewChild('OwlElement') OwlElement: OwlCarousel
yourMethod() {
this.OwlElement.reInit();
}