ios 动态显示的button css样式失效absolute bg等
发布于 5 年前 作者 ljiang 8240 次浏览 来自 问答

absolute的问题:wx:if动态显示cover-view,class样式的设置为absolute,但是有时候left,right,top,bottom没有生效,默认显示在左上角0 * 0;如下图正常如下:

有时候样式会不生效,就对定位元素出现在左上角:

相关代码:

wxml:

<button wx:if="{{inputShow === false && load === true }}" open-type="share" class="shareBtn">
    <cover-image class="share" src="/assets/img/share.png"></cover-image>

</button>


<block wx:if="{{token === false && canIUse && load === true }}">

    <button open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo"

           data-type="gift" size="mini" class="giftBtnCont">

        <cover-image style="width: 100%;height: 100%" src="/assets/img/gift.png"></cover-image>
    </button>

    <button open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo"

           data-type="send" size="mini" class="sendBtn">

        <cover-image style="width: 100%;height: 100%" src="/assets/img/live_say.png" class="share">              </cover-image>
    </button>
</block>

wxss:

.giftBtnCont {
  position: absolute;
  right: 16rpx;
  bottom: 10rpx;
  width: 84rpx;
  height: 84rpx;
  padding-left: 0;
  padding-right: 0;
  background-color: transparent;
}
 
.sendBtn {
  position: absolute;
  left: 16rpx;
  bottom: 10rpx;
  width: 84rpx;
  height: 84rpx;
  background: transparent;
}
 
.shareBtn {
  position: absolute;
  right: 115rpx;
  bottom: 10rpx;
  width: 84rpx;
  height: 84rpx;
  padding-left: 0;
  padding-right: 0;
  background-color: transparent;
}

background的问题:

一个flex cover-view盒子,左边是固定宽高动态添加src的cover-image,中间是不定长文字,右边是动态加载固定宽高的元素,给盒子加上有透明度的background,ios中只会给文字加上背景,图片和动态加载的元素不会显示背景。显示上来看,cover-image没加载src的时候宽高没没起作用。

希望这些问题官方能重视

2 回复

你好,请提供一下出现问题的机型和微信版本,以及能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

切换房间的时候,button在live-player上不见了,没渲染出来

回到顶部