fix: edit widget config

This commit is contained in:
Qiuxia Fan
2022-01-11 20:16:33 +08:00
parent 015416d31d
commit 6189378f28
11 changed files with 91 additions and 86 deletions

View File

@@ -28,6 +28,7 @@ import {
import type { PropType } from "vue";
import { useECharts } from "@/hooks/useEcharts";
import { addResizeListener, removeResizeListener } from "@/utils/event";
/*global Nullable*/
const chartRef = ref<Nullable<HTMLDivElement>>(null);
const { setOptions, resize } = useECharts(chartRef as Ref<HTMLDivElement>);
@@ -45,7 +46,7 @@ onMounted(() => {
if (!chartRef.value) {
return;
}
window.addEventListener("resize", resize);
setOptions(props.option);
addResizeListener(unref(chartRef), resize);
});
@@ -60,7 +61,6 @@ onBeforeUnmount(() => {
if (!chartRef.value) {
return;
}
window.removeEventListener("resize", resize);
removeResizeListener(unref(chartRef), resize);
});
</script>

View File

@@ -20,7 +20,6 @@ import Selector from "./Selector.vue";
import Graph from "./Graph.vue";
import type { App } from "vue";
import VueGridLayout from "vue-grid-layout";
import { ElLoading } from "element-plus";
const components: { [key: string]: any } = {
Icon,
@@ -28,7 +27,6 @@ const components: { [key: string]: any } = {
VueGridLayout,
Selector,
Graph,
ElLoading,
};
const componentsName: string[] = Object.keys(components);