使用 Glide.js 获取当前幻灯片索引

Get Current slide index with Glide.js

当我用 GLide.js

在元素之间滑动时,如何获取当前幻灯片 index/number
 const config = {
    type: "carousel",
    perView: 5,
    startAt: 2,
    perTouch: 1,
    focusAt: "center",
  };
  new Glide(".glide", config)
    .on("swipe.end", function (event) {
      console.log(event);
    })
    .mount();

尝试使用 glide.index

const config = {
  type: "carousel",
  perView: 5,
  startAt: 2,
  perTouch: 1,
  focusAt: "center",
};

var glide = new Glide(".glide", config)

glide.on("swipe.end", function(event) {
  console.log('on swipe.end', glide.index)
})

glide.mount()

console.log(glide.index)