Skip to content

Commit

Permalink
beforeDestroy fix
Browse files Browse the repository at this point in the history
`beforeDestroy` hook placed by mistake inside `methods` block?
  • Loading branch information
sleewoo committed Jun 16, 2017
1 parent ccfd31f commit 848f76e
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 848f76e

Please sign in to comment.