2

不知道我应该如何使用组件。我没有使用模块化构建。

import Glide from '@glidejs/glide'

var glide = new Glide('.glide')

glide.on('build.after', function() {
  // How do I access the component Sizes and the property slideWidth here?
})

glide.mount()
4

1 回答 1

0

您无权访问事件回调中的组件集合。您必须改为创建自定义组件。文档中的更多信息。

var Example = function (Glide, Components, Events) {
  return {
    mount () {
      // Here you can access `Sizes` module
      console.log(Components.Sizes)
    }
  }
}

new Glide('.glide').mount({
  'Example': Example
})
于 2019-02-06T18:28:03.433 回答