fix: resize tempchart on window resize event (#750)

This commit is contained in:
Stefan Dej 2022-04-11 23:46:11 +02:00 committed by GitHub
parent d830493acc
commit b521b1cd1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -228,11 +228,19 @@ export default class TempChart extends Mixins(BaseMixin) {
mounted() {
this.initChart()
window.addEventListener('resize', this.eventListenerResize)
}
beforeDestroy() {
if (typeof window === 'undefined') return
if (this.chart) this.chart.dispose()
window.removeEventListener('resize', this.eventListenerResize)
}
eventListenerResize() {
this.chart?.resize()
}
initChart() {