feat: dom结构优化
parent
545731d6d5
commit
8311f20c82
|
|
@ -575,14 +575,22 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleResize = () => {
|
||||||
|
myChart?.resize();
|
||||||
|
};
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
window.addEventListener("resize", () => myChart?.resize());
|
window.addEventListener("resize", handleResize);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 监听图表数据变化,更新图表
|
// 监听图表数据变化,更新图表
|
||||||
watch(() => props.chartDataArray, () => {
|
watch(() => props.chartDataArray, () => {
|
||||||
initChart();
|
initChart();
|
||||||
}, { deep: true });
|
}, { deep: true });
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
window.removeEventListener("resize", handleResize);
|
||||||
|
myChart?.dispose();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue