vue 项目模块化引入百度地图

 

1.1.安装百度地图依赖包

npm i vue-baidu-map --save

2.在src/main.js导入依赖包

import BaiduMap from 'vue-baidu-map'

Vue.use(BaiduMap, {
ak: 'YOUR_APP_KEY' //这个地方是官方提供的ak密钥
})

3.配置地图的基本信息,在我们需要的组件中引用


:center="{lng:121.6292529148,lat:31.2035397816}"
:zoom='13'
:scroll-wheel-zoom='true'>





vue 项目模块化引入百度地图_第1张图片

最终效果如图:

vue 项目模块化引入百度地图_第2张图片

 

转载于:https://www.cnblogs.com/ting0527/p/11064192.html

你可能感兴趣的:(vue 项目模块化引入百度地图)