设置默认的四个标注,假设我点击index为1的标注时,返回的值是900000001,如图,获取时可能出现锚点对应的下标获取不到的情况,望修复
// html
<view class="intro">
<map class="map" id="map" longitude="{{longitude}}" latitude="{{latitude}}" scale="{{scale}}"
show-location="true" markers="{{markers}}" bindmarkertap="makertap" bindcallouttap="makertap"
enable-zoom="true"></map>
</view>
// js
const app = getApp()
let mapContext = null;
Page({
data: {
scale: 11,
latitude: 34.340515,
longitude: 108.760382,
markers: [
{content: "标注1", id: "12315", display: "ALWAYS", latitude: "34.340515", longitude: "108.760382"},
{content: "标注2", id: "12316", display: "ALWAYS", latitude: "34.344588", longitude: "108.731312"},
{content: "标注2", id: "12316", display: "ALWAYS", latitude: "34.341588", longitude: "108.761312"},
{content: "标注2", id: "12316", display: "ALWAYS", latitude: "34.371588", longitude: "108.711312"}
],
},
onLoad() {
mapContext = wx.createMapContext("map");
// 获取定位上右上角、左下角的值
mapContext.getRegion({
success: (data) => {
this.setData({
ps: 50,
nelng: data.northeast.longitude,
nelat: data.northeast.latitude,
swlng: data.southwest.longitude,
swlat: data.southwest.latitude
},()=>{
})
}
});
},
makertap(sender){
console.log(sender);
}
})
// css
.intro {
text-align: center;
}
.map {
width: 100vw;
height: 100vh;
margin: 0;
padding: 0;
}
请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。