fix: resize tempchart on window resize event (#750)
This commit is contained in:
parent
d830493acc
commit
b521b1cd1e
@ -228,11 +228,19 @@ export default class TempChart extends Mixins(BaseMixin) {
|
|||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initChart()
|
this.initChart()
|
||||||
|
|
||||||
|
window.addEventListener('resize', this.eventListenerResize)
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
if (typeof window === 'undefined') return
|
if (typeof window === 'undefined') return
|
||||||
if (this.chart) this.chart.dispose()
|
if (this.chart) this.chart.dispose()
|
||||||
|
|
||||||
|
window.removeEventListener('resize', this.eventListenerResize)
|
||||||
|
}
|
||||||
|
|
||||||
|
eventListenerResize() {
|
||||||
|
this.chart?.resize()
|
||||||
}
|
}
|
||||||
|
|
||||||
initChart() {
|
initChart() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user