uniapp编译app,map组件cover-view失效问题
2023-02-27 本文已影响0人
前端金城武
项目需要在map上面绘制内容,看文档操作
<map style="width: 100%; height:550rpx;" :latitude="latitude" :longitude="longitude" :markers="covers" :controls="mapbtns" enable-traffic="true">
<cover-view style="width: 200rpx;
height: 100rpx;
background-color: #ee0003;
position: fixed;
top: 10px;" >
换电00 controls
</cover-view>
</map>
发现编译app <cover-view>标签用不了被map盖住了,而小程序是正常的
![](https://img.haomeiwen.com/i24735102/fd2b055ed9b8e9b0.jpg)
最后发现app端跟小程序不一样,app端cover-view需要放在map标签外面才能覆盖map
<map style="width: 100%; height:550rpx;" :latitude="latitude" :longitude="longitude" :markers="covers" :controls="mapbtns" enable-traffic="true">
</map>
<cover-view style="width: 200rpx;
height: 100rpx;
background-color: #ee0003;
position: fixed;
top: 10px;" >
换电00 controls
</cover-view>
![](https://img.haomeiwen.com/i24735102/02a29a74b22056e5.jpg)
大功告成!!(tips:需要添加position: fixed;或者position: absolute;才能覆盖地图上方)