Commit d367ea52 by huyue

修复查看定位问题

1 parent 236ad9ec
...@@ -33,34 +33,26 @@ export default { ...@@ -33,34 +33,26 @@ export default {
return { return {
mapObj: "", mapObj: "",
zoom: 12, zoom: 12,
mapapi: "",
}; };
}, },
created() { mounted() {
this.initMap(); this.initMap();
console.log('地图'); console.log('地图');
}, },
methods: { methods: {
async initMap() { async initMap() {
// console.log(GLMapSdk);
try { try {
new GLMapSdk(async (mapapi) => { // new GLMapSdk(async (mapapi) => {
this.mapapi = mapapi; console.log(this.mapapi, 'mapapi');
console.log(mapapi, 'mapapi'); const mapapi = this.mapapi
const map = await mapapi.invoke("Map", "mapContainer"); const map = await mapapi.invoke("Map", "mapContainer");
const { lng, lat } = this.info; const { lng, lat } = this.info;
mapapi.invoke("centerAndZoom", mapapi.invoke("Point", lng, lat), this.zoom); mapapi.invoke("centerAndZoom", mapapi.invoke("Point", lng, lat), this.zoom);
//向地图中添加缩放控件 mapapi.invoke('NavigationControl')
// var ctrlNav = new window.BMap.NavigationControl({ // mapapi.invoke('enableScrollWheelZoom')
// anchor: BMAP_ANCHOR_TOP_LEFT, this.drawMaker(mapapi, map);
// type: BMAP_NAVIGATION_CONTROL_LARGE, // })
// });
//地图缩放控件
// map.addControl(ctrlNav);
// mapapi.invoke('addControl', ctrlNav)
mapapi.invoke('NavigationControl')
// mapapi.invoke('enableScrollWheelZoom')
this.drawMaker(mapapi, map);
});
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
......
...@@ -12,6 +12,8 @@ import { Common } from '@/utils/common.js' ...@@ -12,6 +12,8 @@ import { Common } from '@/utils/common.js'
import Constants from '@/utils/constants.js' import Constants from '@/utils/constants.js'
import actions from '@/core/actions'; import actions from '@/core/actions';
import GlsxDialog from "@/components/dialog"; import GlsxDialog from "@/components/dialog";
import GlMapSdk from "@/utils/glsk-mapapi-sdk";
console.log(GlMapSdk);
// import axios from 'axios' // import axios from 'axios'
Vue.component('glsx-dialog', GlsxDialog) Vue.component('glsx-dialog', GlsxDialog)
Vue.prototype.btn_size = 'mini' Vue.prototype.btn_size = 'mini'
...@@ -20,7 +22,7 @@ Vue.prototype.$Constants = Constants ...@@ -20,7 +22,7 @@ Vue.prototype.$Constants = Constants
Vue.use(VueRouter); Vue.use(VueRouter);
Vue.use(ElementUI) Vue.use(ElementUI)
Vue.config.productionTip = false; Vue.config.productionTip = false;
Vue.prototype.mapapi = new GlMapSdk()
let router = null; let router = null;
let instance = 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!