angular - angular 5 reInit owl carousel
问题描述
我可以在哪里运行函数 reInit() ngx-owl-carousel ?
我使用 ngx-owl-carousel 模块,并使用 angular 5,
如果路线改变猫头鹰旋转木马被刹车
<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']">
解决方案
在您的组件中:
@ViewChild('OwlElement') OwlElement: OwlCarousel
yourMethod() {
this.OwlElement.reInit();
}
推荐阅读
- python - 运行测试时烧瓶单元测试无法连接到sqlite数据库
- python - 覆盖 Django 的 AuthenticationForm 的字段
- c# - ICAL.NET 重复元素:从开始日期到结束日期的每周二(每周)、每第二个、上周一(每月)
- javascript - TypeError: message.guild.channels.find(...).then 不是函数
- c# - 实体框架和关系有问题
- java - EditText 无法将文本设置为格式化字符串
- ruby-on-rails - 我无法执行 rake db:migrate - Unexpected ':'
- javafx - 如何绑定到 JavaFX 中的 ObservableMap 中的属性?
- sql - 在 DB2 中将 CHAR 插入 DATE
- c++ - shrink_to_fit() 函数会删除空指针吗?