build(projects): 升级依赖,修复TS类型

This commit is contained in:
Soybean
2022-08-31 22:57:53 +08:00
parent f408ea017c
commit 73ce53a388
5 changed files with 28 additions and 26 deletions

View File

@ -81,7 +81,7 @@ export function useEcharts(
) {
const theme = useThemeStore();
const domRef = ref<HTMLElement | null>(null);
const domRef = ref<HTMLElement>();
const initialSize = { width: 0, height: 0 };
const { width, height } = useElementSize(domRef, initialSize);

View File

@ -32,6 +32,7 @@
<script setup lang="ts">
import { ref } from 'vue';
import type { Ref } from 'vue';
import { type ECOption, useEcharts } from '@/composables';
defineOptions({ name: 'DashboardAnalysisTopCard' });
@ -129,7 +130,7 @@ const lineOptions = ref<ECOption>({
data: [2208, 2016, 2916, 4512, 8281, 2008, 1963, 2367, 2956, 678]
}
]
});
}) as Ref<ECOption>;
const { domRef: lineRef } = useEcharts(lineOptions);
const pieOptions = ref<ECOption>({
@ -176,7 +177,7 @@ const pieOptions = ref<ECOption>({
]
}
]
});
}) as Ref<ECOption>;
const { domRef: pieRef } = useEcharts(pieOptions);
</script>

View File

@ -26,12 +26,12 @@ import { onMounted, ref } from 'vue';
import DataSet from '@antv/data-set';
import { Chart } from '@antv/g2';
const pieRef = ref<HTMLElement | null>(null);
const lineRef = ref<HTMLElement | null>(null);
const barRef = ref<HTMLElement | null>(null);
const scatterRef = ref<HTMLElement | null>(null);
const areaRef = ref<HTMLElement | null>(null);
const radarRef = ref<HTMLElement | null>(null);
const pieRef = ref<HTMLElement>();
const lineRef = ref<HTMLElement>();
const barRef = ref<HTMLElement>();
const scatterRef = ref<HTMLElement>();
const areaRef = ref<HTMLElement>();
const radarRef = ref<HTMLElement>();
function renderPieChart() {
if (!pieRef.value) return;

View File

@ -26,6 +26,7 @@
<script setup lang="ts">
import { onUnmounted, ref } from 'vue';
import type { Ref } from 'vue';
import { graphic } from 'echarts';
import { type ECOption, useEcharts } from '@/composables';
@ -62,7 +63,7 @@ const pieOptions = ref<ECOption>({
]
}
]
});
}) as Ref<ECOption>;
const { domRef: pieRef } = useEcharts(pieOptions);
const lineOptions = ref<ECOption>({
@ -252,7 +253,7 @@ const lineOptions = ref<ECOption>({
data: [820, 932, 901, 934, 1290, 1330, 1320]
}
]
});
}) as Ref<ECOption>;
const { domRef: lineRef } = useEcharts(lineOptions);
const barOptions = ref<ECOption>({
@ -287,10 +288,10 @@ const barOptions = ref<ECOption>({
}
}
]
});
}) as Ref<ECOption>;
const { domRef: barRef } = useEcharts(barOptions);
const pictorialBarOption = ref<ECOption>(getPictorialBarOption());
const pictorialBarOption = ref<ECOption>(getPictorialBarOption()) as Ref<ECOption>;
const { domRef: pictorialBarRef } = useEcharts(pictorialBarOption);
function getPictorialBarOption(): ECOption {
const category: string[] = [];
@ -394,7 +395,7 @@ function getPictorialBarOption(): ECOption {
return options;
}
const scatterOptions = ref<ECOption>(getScatterOption());
const scatterOptions = ref<ECOption>(getScatterOption()) as Ref<ECOption>;
const { domRef: scatterRef } = useEcharts(scatterOptions);
function getScatterOption() {
@ -545,7 +546,7 @@ const radarOptions = ref<ECOption>({
]
}
]
});
}) as Ref<ECOption>;
const { domRef: radarRef } = useEcharts(radarOptions);
const gaugeOptions = ref<ECOption>({
@ -738,7 +739,7 @@ const gaugeOptions = ref<ECOption>({
]
}
]
});
}) as Ref<ECOption>;
let intervalId: NodeJS.Timer;
const { domRef: gaugeRef } = useEcharts(gaugeOptions, chart => {