javascript - Vue Slick Carousel 中的当前幻灯片总数
问题描述
我正在尝试使用 vue-slick-carousel 制作幻灯片的当前数量和总数。这是我到目前为止所尝试的。
<VueSlickCarousel ref="carousel">
<div>1 <button tabindex="-1">11</button></div>
<div>2 <button tabindex="-1">22</button></div>
<div>3 <button tabindex="-1">33</button></div>
<div>4<button tabindex="-1">44</button></div>
</VueSlickCarousel>
methods: {
customPaging: function (slider, i) {
var slideNumber = i + 1,
totalSlides = slider.slideCount;
return (
'<a class="custom-dot" role="button" title="' + slideNumber + ' of ' + totalSlides + '"><span class="string">' + slideNumber + '</span></a>'
);
},
},
但这不起作用。
这是下面的 vue-slick-carousel API url。
https://github.com/gs-shop/vue-slick-carousel/blob/master/docs/API.md#methods
我需要修复代码以显示当前幻灯片编号和总幻灯片。例如)“3/10”
解决方案
推荐阅读
- jquery - 如何使用 JQuery .append() 方法添加包含 html 的字符串?
- hibernate - org.springframework.data.util.Pair 类型的目标 bean 不是持久实体的类型 (com.mycompany.hibernatepoc.ConnectionManager
- javascript - 缩短一个大字符串而不削减单词并在Javascript中保存到数组中
- c# - ObservableCollection 的 Notifychange 属性
- excel - 如何在受保护的工作表中包含的 Excel 柱形图上显示工具提示(UserInterfaceOnly)?
- cocoapods - CocoaPods 指向不存在的 Ruby 文件夹
- jquery - 为什么使用 DOM 接口构建时 SVG 路径折叠为 0x0,但在使用 jQuery 字符串构建时有效
- jpa - JPA 实体管理器合并,对象没有变化
- javascript - 如何隐藏选择字段中的所有其他选项字段
- angular - Angular e2e 在路由后超时之前不会寻找标签