markers: [{
iconPath: "../../img/bike.png",
id: 0,
latitude: 32.02984542637893,
longitude: 120.87840606613159,
width: 24,
height: 34
},
{
iconPath: "../../img/bike.png",
id: 1,
latitude: 32.02984542637123,
longitude: 120.87840606613122,
width: 24,
height: 34
}]
代码应该是没什么问题,markers我就setDate过一次
你找找是不是还有什么地方setData了那个markers。或者你在wxml显示一下那个markers是不是正确的
markers_new = [{
iconPath: "../../img/bike.png",
id: 0,
latitude: 23.15239951121,
longitude: 113.36770856218,
width: 24,
height: 34
},
{
iconPath: "../../img/bike.png",
id: 1,
latitude: 23.15319565481,
longitude: 113.368644799478,
width: 24,
height: 34
}];
that.setData({
markers: markers_new
})
这两个位置还是只显示一个图标呢
我看了你的那个位置,真的重叠了。给你两经纬度
la:23.15239951121;long:113.36770856218
la:23.15319565481; long:113.368644799478
你测一下这两个位置
<map class='map_w' id="myMap" markers="{{markers}}" style='height:{{screenHeight}}px;' controls="{{controls}}" longitude='109.518198' latitude='18.257981' bindregionchange="regionchange" show-location>
</map>
markers_new = [{
iconPath: "../../img/bike.png",
id: 0,
latitude: 32.02984542637893,
longitude: 120.87840606613159,
width: 24,
height: 34
},
{
iconPath: "../../img/bike.png",
id: 1,
latitude: 32.02984542123123,
longitude: 120.87840606123123,
width: 24,
height: 34
}];
that.setData({
markers: markers_new
})
你贴个map组件和marker的js 代码图片出来看看
还是不行 呀~~~~~~~~~~~~~~
你试试经纬度相距远一点,估计是重叠了