diff --git a/src/components/chinaMap/chinaMap.vue b/src/components/chinaMap/chinaMap.vue
index 0821b66..22287a5 100644
--- a/src/components/chinaMap/chinaMap.vue
+++ b/src/components/chinaMap/chinaMap.vue
@@ -68,8 +68,8 @@
-
-
![]()
{{ item.text }}
+
+
![]()
{{ item.text }}
@@ -193,20 +193,19 @@ function changeTab(i) {
item.isChecked = false
return item
})
- myChart.value.setOption({});
- initMap()
+ let myChart = echarts.init(document.querySelector('.china-map-container'));
+ initMap(myChart)
}
-let myChart = ref(null)
onMounted(() => {
console.log('reload')
- myChart.value = echarts.init(document.querySelector('.china-map-container'));
+ let myChart = echarts.init(document.querySelector('.china-map-container'));
echarts.registerMap('china', mapJson);
- initMap();
+ initMap(myChart);
})
-function initMap() {
+function initMap(myChart) {
let option = {
tooltip: {
show: false,
@@ -286,8 +285,8 @@ function initMap() {
],
};
// myChart.value.clear()
- myChart.value.setOption(option);
- myChart.value.on('click', function (res) {
+ myChart.setOption(option);
+ myChart.on('click', function (res) {
if ('scatter' === res.componentSubType) {
alert(`点击了 ${res.name} 图标`);
}
@@ -296,7 +295,7 @@ function initMap() {
}
});
window.addEventListener('resize', () => {
- myChart.value.resize()
+ myChart.resize()
})
}