https://dafrok.github.io/vue-baidu-map/#/zh/index
npm config set registry=https://registry.npmmirror.com
查看npm数据源
npm config get registry
npm install vue-baidu-map --save
import BaiduMap from 'vue-baidu-map'
Vue.use(BaiduMap, {
ak: ''
})
index.vue
<template>
<baidu-map class="bm-view" :center="center" :zoom="zoom" :scroll-wheel-zoom="true">
<bm-scale anchor="BMAP_ANCHOR_TOP_RIGHT"></bm-scale>
<bm-navigation anchor="BMAP_ANCHOR_TOP_RIGHT"></bm-navigation>
<bm-geolocation anchor="BMAP_ANCHOR_BOTTOM_RIGHT" :showAddressBar="true" :autoLocation="true"></bm-geolocation>
</baidu-map>
</template>
<script>
export default {
name: 'Index',
components: {
},
data() {
return {
lineChartData: lineChartData.newVisitis,
center: {lng: 108.889191, lat:34.274342},
zoom: 15
}
},
}
</script>
<style>
.bm-view {
width: 100%;
height: 500px;
}
</style>
