相关文章推荐
温暖的消炎药  ·  Macbook ...·  2 天前    · 
谦和的马克杯  ·  TypeError: Input ‘y‘ ...·  1 月前    · 
深沉的凉茶  ·  理解 JavaScript 的 ...·  1 年前    · 
 <map id="mapId" longitude="{{longitude}}" latitude="{{latitude}}" markers="{{markers}}" style="width: 100%; height: 100%;" scale="11">
<!-- <cover-view slot="callout">
<block wx:for="{{customCalloutMarkerIds}}" wx:key="*this">
<cover-view marker-id="{{item}}">
</cover-view>
</block>
</cover-view> -->

自定义气泡内容, 添加进markes

let markers = []
if(list.length > 0){
list.forEach(item=>{
let normalCallout = {
id: item.id,
latitude: item.lon,
longitude: item.lat,
iconPath: item.onoff == '上线' ? '/images/location1.png' : '/images/location3.png',
callout: {
content: `名称:${item.name}\n状态:${item.onoff}`,
color: '#000',
fontSize: 12,
borderWidth: 1,
borderRadius: 10,
borderColor: '#ccc',
bgColor: '#fff',
padding: 10,
display: 'BYCLICK',
textAlign: 'left',
markers.push(normalCallout)