new-map
ihzero 2022-10-26 16:03:40 +08:00
parent f569dfe3e8
commit fce13d6189
3 changed files with 26251 additions and 6 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="relative"> <div class="relative h-full">
<div <div
v-if="isBack" v-if="isBack"
@click="onBack" @click="onBack"
@ -35,10 +35,10 @@
}, },
height: { height: {
type: String as PropType<string>, type: String as PropType<string>,
default: 'calc(100vh - 0px)', default: '100%',
}, },
}, },
setup() { setup(_, { emit }) {
const chartRef = ref<HTMLDivElement | null>(null) const chartRef = ref<HTMLDivElement | null>(null)
const isBack = ref<boolean>(false) const isBack = ref<boolean>(false)
const { setOptions, getInstance } = useECharts(chartRef as Ref<HTMLDivElement>) const { setOptions, getInstance } = useECharts(chartRef as Ref<HTMLDivElement>)
@ -257,12 +257,15 @@
} }
onMounted(async () => { onMounted(async () => {
mapJSON.value = (await (await import('./lcxz.json')).default) as any const resData = (await (await import('./lcxz1.json')).default) as any
mapJSON.value = resData
tempMapJSON.value = deepMerge(mapJSON.value) tempMapJSON.value = deepMerge(mapJSON.value)
mapInit() mapInit()
getInstance()?.on('click', (e) => { getInstance()?.on('click', (e) => {
if (e.seriesType == 'map') { if (e.seriesType == 'map') {
const temp = mapJSON.value.features.filter((obj) => obj.properties.name == e.name) const temp = mapJSON.value.features.filter((obj) => obj.properties.name == e.name)
emit('onMapChange', deepMerge(temp[0].properties))
if (temp) { if (temp) {
isBack.value = true isBack.value = true
tempMapJSON.value = deepMerge({ tempMapJSON.value = deepMerge({

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,7 @@
</div> </div>
</div> </div>
<div class="flex-1"> <div class="flex-1">
<!-- <Map /> --> <Map @onMapChange="onMapChange" />
</div> </div>
<div class="flex"> <div class="flex">
<div class="bg-[#10272F] bg-opacity-80"> <div class="bg-[#10272F] bg-opacity-80">
@ -75,7 +75,12 @@
Head, Head,
}, },
setup() { setup() {
return {} function onMapChange(e) {
console.log(e)
}
return {
onMapChange,
}
}, },
}) })
</script> </script>