https://developers.weixin.qq.com/miniprogram/dev/component/map.html
// 地图模式获取中心点
regionchange(e) {
// 地图发生变化的时候,获取中间点,也就是用户选择的位置toFixed
if (e.type == 'end' && (e.causedBy == 'scale' || e.causedBy == 'drag')) {
var that = this;
this.mapCtx = wx.createMapContext("map4select");
this.mapCtx.getCenterLocation({
type: 'gcj02',
success: function (res) {
let { centerLon, centerLat } = that.data;
if(centerLon==res.longitude&¢erLat==res.longitude)return;
let {markers} = that.data;
markers[0] = {
id: 'center',
latitude: res.latitude - 0,
longitude: res.longitude - 0,
iconPath: "/assets/images/home/pot.png",
width: 26,
height: 32,
zIndex: 999
}
that.setData({
centerLon:res.longitude,
centerLat:res.latitude,
markers,
mapTask:{}
})
// setTimeout(()=>{
// that.setData({
// mapTask:{}
// })
// that.mapModelTaskList(res.latitude - 0,res.longitude - 0)
// },1500)
}
})
}
},
点击图标变大效果
markers.forEach((item) => {
// item.zIndex = taskIndex;
item.iconPath = "";
if (item.id == taskIndex) {
item.zIndex = 0;
item.width = 80;
item.height = 56;
item.iconPath = "/assets/images/home/pot-q.png"
//assets/images/home/pot-q.png
// item.iconPath = "/assets/images/home/select.png"
} else if (item.id != 'center') {
// item.zIndex = taskIndex;
item.width = 50;
item.height = 35;
item.iconPath = "/assets/images/home/pot-q.png"
// item.iconPath = "/assets/images/home/pot.png"
}
})
请问下解决了吗
请具体描述问题出现的流程,并提供能复现问题的简单代码片段https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html
用出现问题的手机扫码提供下扫码结果截图