Files
dvcp_v2_webapp/project/fengdu/AppBIBoard/components/fdMap.vue

77 lines
1.6 KiB
Vue
Raw Normal View History

2023-10-23 09:18:23 +08:00
<template>
<section class="fdMap"/>
</template>
<script>
import * as echarts from 'echarts'
import geoJSON from "../assets/fengduGeo.json"
import fdEdge from "../assets/fdEdge.json"
export default {
name: "fdMap",
2023-10-23 10:48:30 +08:00
model: {
prop: "ins",
event: "input"
},
props: {
ins: {default: null}
},
2023-10-23 09:18:23 +08:00
data() {
return {
map: null
}
},
methods: {
init(c = 0) {
if (this.$el) {
echarts.registerMap('fengdu', {geoJSON})
echarts.registerMap('fd', {geoJSON: fdEdge})
this.map = echarts.init(this.$el)
this.map.setOption({
geo: [
{
show: true,
map: 'fengdu',
itemStyle: {
areaColor: '#02bcff29',
borderColor: '#02FEFF21',
borderWidth: 1,
},
label: {
show: true,
color: '#02FEFF'
},
emphasis: {
disabled: true
},
zoom: 1.2
},
{
show: true,
map: 'fd', itemStyle: {
areaColor: 'transparent',
borderWidth: 2,
borderColor: '#02FEFF',
// shadowOffsetY: 2,
// shadowColor: '#02FEFF'
},
emphasis: {
disabled: true
},
zoom: 1.2
},
]
})
2023-10-23 10:48:30 +08:00
this.$emit("input", this.map)
2023-10-23 09:18:23 +08:00
} else if (c < 5) setTimeout(() => this.init(++c), 500)
}
},
mounted() {
this.init()
}
}
</script>
<style scoped lang="scss">
.fdMap {
}
</style>