vue cli3 中使用echarts地圖

1:工程添加echarts,

npm install echarts --save

yarn add echarts --save

2:在main.js中引入echarts

import echarts from 'echarts'

3:需要註冊百度地圖API的密匙;

註冊地址:http://lbsyun.baidu.com/

4:在index.html中全局引用

<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=這裏是祕鑰"></script>

5:地圖右下角有說明

在index.html中引入如下代碼

<style>

.BMap_cpyCtrl {

display: none;

}

.anchorBL {

display: none;

}

</style>

6:然後按照echart例子就可以顯示出來了

例子地址:https://echarts.baidu.com/examples/editor.html?c=map-polygon

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章