Commit 236ad9ec by huyue

修复

1 parent 4855f8b5
......@@ -38,25 +38,32 @@ export default {
},
created() {
this.initMap();
console.log('地图');
},
methods: {
async initMap() {
new GLMapSdk(async (mapapi) => {
try {
new GLMapSdk(async (mapapi) => {
this.mapapi = mapapi;
console.log(mapapi, 'mapapi');
const map = await mapapi.invoke("Map", "mapContainer");
const { lng, lat } = this.info;
mapapi.invoke("centerAndZoom", mapapi.invoke("Point", lng, lat), this.zoom);
//向地图中添加缩放控件
var ctrlNav = new window.BMap.NavigationControl({
anchor: BMAP_ANCHOR_TOP_LEFT,
type: BMAP_NAVIGATION_CONTROL_LARGE,
});
// var ctrlNav = new window.BMap.NavigationControl({
// anchor: BMAP_ANCHOR_TOP_LEFT,
// type: BMAP_NAVIGATION_CONTROL_LARGE,
// });
//地图缩放控件
// map.addControl(ctrlNav);
mapapi.invoke('addControl', ctrlNav)
// mapapi.invoke('addControl', ctrlNav)
mapapi.invoke('NavigationControl')
// mapapi.invoke('enableScrollWheelZoom')
this.drawMaker(mapapi, map);
});
} catch (error) {
console.log(error);
}
},
// 激活位置
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!