Skip to content
This repository was archived by the owner on Jul 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/vue-awesome-swiper.js

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions src/swiper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,36 @@
configurable: true
})
}
// as of swiper 4.0.7
// http://idangero.us/swiper/api/#events
const DEFAULT_EVENTS = [
'beforeDestroy',
'slideChange',
'slideChangeTransitionStart',
'slideChangeTransitionEnd',
'slideNextTransitionStart',
'slideNextTransitionEnd',
'slidePrevTransitionStart',
'slidePrevTransitionEnd',
'transitionStart',
'transitionEnd',
'touchStart',
'touchMove',
'touchMoveOpposite',
'sliderMove',
'touchEnd',
'click',
'tap',
'doubleTap',
'imagesReady',
'progress',
'reachBeginning',
'reachEnd',
'fromEdge',
'setTranslate',
'setTransition',
'resize'
]

// export
export default {
Expand All @@ -64,6 +94,16 @@
mountInstance() {
const swiperOptions = Object.assign({}, this.globalOptions, this.options)
this.swiper = new Swiper(this.$el, swiperOptions)
this.bindEvents()
},
bindEvents() {
const vm = this
DEFAULT_EVENTS.forEach(eventName => {
this.swiper.on(eventName, function() {
// NOTE - `this` is the swiper instance
vm.$emit(eventName, this, ...arguments)
})
})
}
},
data() {
Expand Down