Skip to content

Commit

Permalink
Merge pull request #36 from sleewoo/patch-1
Browse files Browse the repository at this point in the history
beforeDestroy fix
  • Loading branch information
Wlada committed Jun 16, 2017
2 parents ccfd31f + 848f76e commit 00a33a2
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/Carousel3d.vue
Original file line number Diff line number Diff line change
Expand Up @@ -375,20 +375,8 @@
this.$el.style.cssText += 'height:' + this.slideHeight + 'px;'
this.$el.childNodes[0].style.cssText += 'width:' + this.slideWidth + 'px;' + ' height:' + this.slideHeight + 'px;'
},
beforeDestroy () {
if (!this.$isServer) {
this.detachMutationObserver()
if ('ontouchstart' in window) {
this.$el.removeEventListener('touchmove', this.handleMousemove)
} else {
this.$el.removeEventListener('mousemove', this.handleMousemove)
}
window.removeEventListener('resize', this.setSize)
}
}
},
mounted () {
this.computeData()
this.attachMutationObserver()
Expand All @@ -406,6 +394,20 @@
this.$el.addEventListener('mousemove', this.handleMousemove)
}
}
},
beforeDestroy () {
if (!this.$isServer) {
this.detachMutationObserver()
if ('ontouchstart' in window) {
this.$el.removeEventListener('touchmove', this.handleMousemove)
} else {
this.$el.removeEventListener('mousemove', this.handleMousemove)
}
window.removeEventListener('resize', this.setSize)
}
}
}
</script>
Expand Down

0 comments on commit 00a33a2

Please sign in to comment.