Skip to content

Commit

Permalink
fix(MdSteppers): recalculate styles on window resize (#1394)
Browse files Browse the repository at this point in the history
* fix(MdSteppers): overflow on resize

* refactor(MdSteppers): add beforeDestroy hook to remove resize listener
  • Loading branch information
Samuell1 authored and marcosmoura committed Jan 12, 2018
1 parent edb484e commit d3953f7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/MdSteppers/MdSteppers.vue
Expand Up @@ -186,6 +186,8 @@
if ('ResizeObserver' in window) {
this.resizeObserver = new window.ResizeObserver(this.calculateStepperPos)
this.resizeObserver.observe(this.$el)
} else {
window.addEventListener('resize', this.calculateStepperPos)
}
if (steppersContent) {
Expand Down Expand Up @@ -244,7 +246,12 @@
this.setupObservers()
this.setupWatchers()
}, 100)
}
},
beforeDestroy () {
if (!('ResizeObserver' in window)) {
window.removeEventListener('resize', this.calculateStepperPos)
}
},
})
</script>

Expand Down

0 comments on commit d3953f7

Please sign in to comment.