uni-app map iOS真机不显示多边形polygon?marker无法点击?
答案:
用 nvue
nvue不显示markers?
答案:在marker(point点中添加id)
最终demo代码:
gaoDeMapNvue.nvue
<template>
<div>
<view class="page-body">
<view class="page-section page-section-gap">
<map style="width: 375px; height: 667px;" :latitude="latitude" :longitude="longitude" :markers="covers"
:polyline="polylineData" :polygons="polygonData" :scale=14>
</map>
</view>
</view>
</div>
</template>
<script>
export default {
data() {
return {
latitude: 39.90931,
longitude: 116.39742,
covers: [{
id: 0, // 使用 marker点击事件 需要填写id
title: 'map',
latitude: 39.96491,
longitude: 116.39742,
iconPath: '/static/madLocal.png',
content: '大家好啊',
title: '9999999999999'
}, {
id: 1, // 使用 marker点击事件 需要填写id
title: 'map',
latitude: 39.89931,
longitude: 116.39742,
iconPath: '/static/logo.png',
title: '9999999999999',
}],
markers: [{}, {}, {}],
polylineData: [{
points: [{
latitude: 39.91931,
longitude: 116.39742
},
{
latitude: 39.91931,
longitude: 116.51
}
],
color: "#0000AA",
width: 5
}],
polygonData: [{
points: [{
latitude: 39.90951,
longitude: 116.39742
},
{
latitude: 39.90951,
longitude: 116.51
}, {
latitude: 39.80931,
longitude: 116.51
}, {
latitude: 39.90931,
longitude: 116.39742
}
],
strokeColor: "#007AFF",
fillColor: "#007A33",
strokeWidth: 5,
width: 50,
zIndex: 0,
level: 0
}]
}
}
}
</script>
<style>
</style>
效果图(小程序和iOS真机) (包含自定义图标,折线,多边形遮罩层)