This commit is contained in:
GGJ
2024-01-02 16:35:07 +08:00
5 changed files with 473 additions and 17 deletions

View File

@@ -9,9 +9,13 @@ import 'echarts/lib/component/dataZoom'
const chartRef = ref<HTMLDivElement>()
const props = defineProps(['options'])
let chart: echarts.ECharts | null = null
let chart: echarts.ECharts | any = null
const resizeHandler = () => {
chart?.resize()
chart.getZr().painter.getViewportRoot().style.display = "none";
requestAnimationFrame(() => {
chart.resize()
chart.getZr().painter.getViewportRoot().style.display = "";
})
}
const initChart = () => {
chart?.dispose()
@@ -88,7 +92,6 @@ const initChart = () => {
],
yAxis: [
{
type: 'value',
nameTextStyle: {
@@ -148,9 +151,7 @@ const initChart = () => {
})
}
onMounted(() => {
setTimeout(() => {
// initChart()
}, 20)
initChart()
window.addEventListener('resize', resizeHandler)
})
defineExpose({ initChart })