首页 > 解决方案 > 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”

标签: javascriptvue.js

解决方案


推荐阅读