美文网首页
uniapp编译app,map组件cover-view失效问题

uniapp编译app,map组件cover-view失效问题

作者: 前端金城武 | 来源:发表于2023-02-27 14:08 被阅读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;才能覆盖地图上方)

相关文章

网友评论

      本文标题:uniapp编译app,map组件cover-view失效问题

      本文链接:https://www.haomeiwen.com/subject/etihldtx.html