终端运行管理

This commit is contained in:
仲么了
2024-01-02 13:45:20 +08:00
parent 0ed9c950ee
commit 43ca358cb8
3 changed files with 464 additions and 6 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 })