/**
* 视野发生变化时触发:见页面bindregionchange事件
*/
regionchange: function (e) {
//console.log("regionchange_type="+e.type)
e.type == 'end' ? this.getLngLat() : '';
},
/**
* 获取中间点的经纬度,并mark出来
*/
getLngLat() {
let that = this;
this.mapCtx = wx.createMapContext("map"); //与xml里面的<map id="{{map}}">相对应
this.mapCtx.getCenterLocation({
success: function (res) {
//console.log("getCenterLocation=" + JSON.stringify(res))
that.setData({
markers_ic: [{
id: "1",
iconPath: "/pages/inc/images/ic_location.png",
longitude: res.longitude,
latitude: res.latitude,
width: 20,
height: 20
}]
})
//自己 的逻辑代码把(res.longitude,res.latitude,)传进
that.getcurrentparking(res.longitude, res.latitude)
}
})
},