update
This commit is contained in:
@@ -68,8 +68,8 @@
|
|||||||
<div class="china-map-container"></div>
|
<div class="china-map-container"></div>
|
||||||
|
|
||||||
<div class="map-legend">
|
<div class="map-legend">
|
||||||
<div class="legend-item" v-for="(item,i) in legendList" :key="i">
|
<div v-for="(item,i) in legendList" :key="i" class="legend-item">
|
||||||
<div><img class="legend-img" :src="item.img" alt=""> {{ item.text }}</div>
|
<div><img :src="item.img" alt="" class="legend-img"> {{ item.text }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -193,20 +193,19 @@ function changeTab(i) {
|
|||||||
item.isChecked = false
|
item.isChecked = false
|
||||||
return item
|
return item
|
||||||
})
|
})
|
||||||
myChart.value.setOption({});
|
let myChart = echarts.init(document.querySelector('.china-map-container'));
|
||||||
initMap()
|
initMap(myChart)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let myChart = ref(null)
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
console.log('reload')
|
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);
|
echarts.registerMap('china', mapJson);
|
||||||
initMap();
|
initMap(myChart);
|
||||||
})
|
})
|
||||||
|
|
||||||
function initMap() {
|
function initMap(myChart) {
|
||||||
let option = {
|
let option = {
|
||||||
tooltip: {
|
tooltip: {
|
||||||
show: false,
|
show: false,
|
||||||
@@ -286,8 +285,8 @@ function initMap() {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
// myChart.value.clear()
|
// myChart.value.clear()
|
||||||
myChart.value.setOption(option);
|
myChart.setOption(option);
|
||||||
myChart.value.on('click', function (res) {
|
myChart.on('click', function (res) {
|
||||||
if ('scatter' === res.componentSubType) {
|
if ('scatter' === res.componentSubType) {
|
||||||
alert(`点击了 ${res.name} 图标`);
|
alert(`点击了 ${res.name} 图标`);
|
||||||
}
|
}
|
||||||
@@ -296,7 +295,7 @@ function initMap() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
window.addEventListener('resize', () => {
|
window.addEventListener('resize', () => {
|
||||||
myChart.value.resize()
|
myChart.resize()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user