Merge pull request #129 from shy1118999/patch-1

fix:cannot re-render if dom is deleted <Update echarts.ts>
This commit is contained in:
Soybean 2022-09-09 22:32:15 +08:00 committed by GitHub
commit f7ca2782b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -130,6 +130,10 @@ export function useEcharts(
const stopSizeWatch = watch([width, height], ([newWidth, newHeight]) => {
initialSize.width = newWidth;
initialSize.height = newHeight;
if (newWidth === 0 && newHeight === 0) {
// 节点被删除 将chart置为空
chart = null
}
if (canRender()) {
if (!isRendered()) {
render();