improve demo resizing

This commit is contained in:
Philipp Kühn
2021-02-02 11:37:24 +01:00
committed by Hans Pagel
parent 6fb953dab8
commit 138cd75b3c
3 changed files with 32 additions and 3 deletions

View File

@@ -23,6 +23,26 @@ export default {
],
}
},
data() {
return {
resizeObserver: null,
}
},
mounted() {
this.resizeObserver = new window.ResizeObserver(() => {
if (window.parentIFrame) {
window.parentIFrame.sendMessage('resize')
}
})
this.resizeObserver.observe(document.body)
},
beforeDestroy() {
this.resizeObserver.unobserve(document.body)
},
}
</script>