style:图表监听浏览器窗口变化重绘

main
黄伟杰 1 week ago
parent f9aca54f61
commit 1a76a98995

@ -1,4 +1,4 @@
import { onUnmounted } from 'vue' import { onMounted, onUnmounted } from 'vue'
import * as echarts from 'echarts' import * as echarts from 'echarts'
export const colors = { export const colors = {
@ -45,7 +45,12 @@ export function useChart(domId: string) {
chart?.resize() chart?.resize()
} }
onMounted(() => {
window.addEventListener('resize', resize)
})
onUnmounted(() => { onUnmounted(() => {
window.removeEventListener('resize', resize)
chart?.dispose() chart?.dispose()
}) })

Loading…
Cancel
Save