Skip to content

Commit d3953f7

Browse files
Samuell1marcosmoura
authored andcommitted
fix(MdSteppers): recalculate styles on window resize (#1394)
* fix(MdSteppers): overflow on resize * refactor(MdSteppers): add beforeDestroy hook to remove resize listener
1 parent edb484e commit d3953f7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/components/MdSteppers/MdSteppers.vue

+8-1
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@
186186
if ('ResizeObserver' in window) {
187187
this.resizeObserver = new window.ResizeObserver(this.calculateStepperPos)
188188
this.resizeObserver.observe(this.$el)
189+
} else {
190+
window.addEventListener('resize', this.calculateStepperPos)
189191
}
190192
191193
if (steppersContent) {
@@ -244,7 +246,12 @@
244246
this.setupObservers()
245247
this.setupWatchers()
246248
}, 100)
247-
}
249+
},
250+
beforeDestroy () {
251+
if (!('ResizeObserver' in window)) {
252+
window.removeEventListener('resize', this.calculateStepperPos)
253+
}
254+
},
248255
})
249256
</script>
250257

0 commit comments

Comments
 (0)