在工具上使用position: fixed页面可以显示,真机上不显示
发布于 5 年前 作者 xuyan 1722 次浏览 来自 问答
  • 当前 Bug 的表现(可附上截图)

工具上(页面左上方模拟器规格是默认的iphone5):

 

真机上安卓手机(华为荣耀play):

很明显 这个按钮"这是什么"没有显示,把样式都检查了,这个button使用了position: fixed(悬浮起来了),

  • 预期表现

    我希望button是悬浮的,这样不会挤压map的空间,同时我自定义的组件都使用了position: fixed,同样在工具页面可以显示,真机上不能显示(都是悬浮在地图上),我测试过单独使用自定义组件和这样使用button真机都是显示的,是map上不能悬浮东西吗,有什么解决的方案吗,谢谢

  • 复现路径
  • 提供一个最简复现 Demo

下面代码就是页面全部内容了.

wxml:

<view class=“container”>

<button bindtap=‘buttonTap’ class=‘my_button’>这是什么</button>

<map id=“map” latitude="{{latitude}}" longitude="{{longitude}}" markers="{{markers}}" show-location controls="{{controls}}" scale=“17” bindcontroltap=“bindcontroltap”  bindregionchange=“onregionchange” />

</view>

<button bindtap=‘buttonTap’ class=‘my_button’>这是什么</button>

wxss:

.container {

height: 100vh;

width: 100%;

-webkit-overflow-scrolling: touch;

}

#map {

height: 100%;

width: 100%;

}

.my_button{

width: 100%;

height: 100rpx;

position: fixed; /* 这是问题*/

top: 0rpx;

right: 0rpx;

overflow: hidden;

z-index: 9999;

background-color: red

}

1 回复
回到顶部