Commit d367ea52 by huyue

修复查看定位问题

1 parent 236ad9ec
......@@ -33,34 +33,26 @@ export default {
return {
mapObj: "",
zoom: 12,
mapapi: "",
};
},
created() {
mounted() {
this.initMap();
console.log('地图');
},
methods: {
async initMap() {
// console.log(GLMapSdk);
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,
// });
//地图缩放控件
// map.addControl(ctrlNav);
// mapapi.invoke('addControl', ctrlNav)
mapapi.invoke('NavigationControl')
// mapapi.invoke('enableScrollWheelZoom')
this.drawMaker(mapapi, map);
});
// new GLMapSdk(async (mapapi) => {
console.log(this.mapapi, 'mapapi');
const mapapi = this.mapapi
const map = await mapapi.invoke("Map", "mapContainer");
const { lng, lat } = this.info;
mapapi.invoke("centerAndZoom", mapapi.invoke("Point", lng, lat), this.zoom);
mapapi.invoke('NavigationControl')
// mapapi.invoke('enableScrollWheelZoom')
this.drawMaker(mapapi, map);
// })
} catch (error) {
console.log(error);
}
......
......@@ -12,6 +12,8 @@ import { Common } from '@/utils/common.js'
import Constants from '@/utils/constants.js'
import actions from '@/core/actions';
import GlsxDialog from "@/components/dialog";
import GlMapSdk from "@/utils/glsk-mapapi-sdk";
console.log(GlMapSdk);
// import axios from 'axios'
Vue.component('glsx-dialog', GlsxDialog)
Vue.prototype.btn_size = 'mini'
......@@ -20,7 +22,7 @@ Vue.prototype.$Constants = Constants
Vue.use(VueRouter);
Vue.use(ElementUI)
Vue.config.productionTip = false;
Vue.prototype.mapapi = new GlMapSdk()
let router = null;
let instance = null;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!