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盖住了,而小程序是正常的


微信图片_202302281405441.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>
微信图片_20230228140544.jpg

大功告成!!(tips:需要添加position: fixed;或者position: absolute;才能覆盖地图上方)

上一篇 下一篇

猜你喜欢

热点阅读