glidejs - 如何访问“build.after”中的组件大小 [Glide.js v 3.1.0]
问题描述
不知道我应该如何使用组件。我没有使用模块化构建。
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()
解决方案
您无权访问事件回调中的组件集合。您必须改为创建自定义组件。文档中的更多信息。
var Example = function (Glide, Components, Events) {
return {
mount () {
// Here you can access `Sizes` module
console.log(Components.Sizes)
}
}
}
new Glide('.glide').mount({
'Example': Example
})
推荐阅读
- swift - 如何解决此问题:“UIScrollView”类型的值没有成员文本
- c++ - 使用 cmake 构建比特币
- proxy - 如何判断 Python 中的 GET 请求是使用 https 还是 http 代理?
- html - 以'/'和'~/'开头的路径有什么区别
- c# - 如何使用 .net 核心在 electron.net 中使用嵌入式 firebird 数据库
- java - 我应该对 Base64 或 Java 的默认 ISO-6559-1 使用 ASCII 编码吗?
- java - 在 try-catch 块中,“finally”是否会覆盖异常块中的“return”?
- python - 用于在 Python 中提取脚本标签的正则表达式
- python - 如何在抽象模型的 ManyToMany 字段中设置related_name?
- sql - 更改后如何知道列的先前长度