diff --git a/src/ECharts.ts b/src/ECharts.ts index fd98607..ab25c76 100644 --- a/src/ECharts.ts +++ b/src/ECharts.ts @@ -1,6 +1,5 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { - install, defineComponent, ref, unref, @@ -39,8 +38,6 @@ import { import "./style.css"; import { omitOn } from "./utils"; -install(); - const TAG_NAME = "x-vue-echarts"; if (Vue2) { @@ -145,10 +142,14 @@ export default defineComponent({ instance.setOption(option || realOption.value, realUpdateOptions.value); + function resize() { + if (instance && !instance.isDisposed()) { + instance.resize(); + } + } // Make sure the chart fits the container in next UI render (after current task) - setTimeout(() => { - instance.resize(); - }); + nextTick(resize); + setTimeout(resize); } function setOption(option: Option, updateOptions?: UpdateOptions) {