Vue2.6+Echarts+Bmap构建地图
在你的页面中引入 你的echarts库中的bmap库
// 引入依赖库 在echarts中使用bmap进行创建地图
import "echarts/extension/bmap/bmap"
然后直接开始写你的地图组件 搭建页面
<template>
<div class="wrapper">
<div class="echarts" id="charts"></div>
</div>
</template>
<script>
// 引入依赖库 在echarts中使用bmap进行创建地图
import "echarts/extension/bmap/bmap"
export default {
name: '',
components: {},
data: () => {
return {
opstion: {}
}
},
mounted() {
this.isShowcharts()
},
methods: {
isShowcharts() {
const charts = this.$echarts.init(document.getElementById("charts"));
const opstion = {
bmap: {
key: 'G1LFyjrNGIkns5OfpZnrCGAKxpycPLwb',
center: [104.114129, 37.550339],
zoom: 5,
roam: false,
//地图样式库
mapStyle: {
styleJson: [{
'featureType': 'water