bugfix: destroy resize event before component destroy

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej committed 2021-04-03 22:11:51 +02:00
1 parent 5a8a42cfdd
commit b3e9d85701
1 file changed
+7 -3
+7 -3
View File
@@ -304,14 +304,18 @@ export default {
if(isVisible && this.chart !== null) this.chart.resize()
if(this.chart !== null) this.updateChart()
},
resize() {
this.chart?.resize();
}
},
created() {
window.addEventListener('resize', () => {
if (this.chart) this.chart.resize()
})
window.addEventListener('resize', this.resize)
},
mounted: function() {
this.createChart()
},
beforeDestroy() {
window.removeEventListener('resize', this.resize);
}
}
</script>