fix: 修复 echart 无法正确渲染的问题
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, ref, useTemplateRef, watch } from 'vue';
|
||||
import { computed, nextTick, onErrorCaptured, ref, useTemplateRef, watch } from 'vue';
|
||||
import { useSetPieChart } from '@/hooks/chart/usePieChart';
|
||||
import {
|
||||
formatData,
|
||||
@@ -112,6 +112,11 @@ const chartVisible = computed(() => {
|
||||
|
||||
return series.value?.data?.length;
|
||||
});
|
||||
|
||||
onErrorCaptured((err) => {
|
||||
console.log(`err`, err);
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -17,8 +17,10 @@ function useSetPieChart(
|
||||
let chartInstance: any;
|
||||
|
||||
onMounted(() => {
|
||||
console.log(`1233313123`,dom.value, series.value);
|
||||
|
||||
// 检测边界范围 dom 和 series 是否存在
|
||||
if (!dom.value && !series) return;
|
||||
if (!dom.value || !series.value) return;
|
||||
|
||||
// 在 dom 挂载之后,显示饼图
|
||||
// 在 dom 挂载之后,显示饼图
|
||||
|
||||
Reference in New Issue
Block a user