- 試過官方的cover-view包裹加z-index不生效
1、浮在定位按鈕表層
- 問題顯示如下
<view class='pageContent'>
<text>超長的頁面內容</text>
</view>
<!-- 底部定位元素 -->
<view class='foot_cate'>
<button>立即支付</button>
</view>
.foot_cate {
position: fixed;
bottom: 0;
width: 100%;
background-color: #fff;
}
- 解決完成顯示
<scroll-view scroll-y="true" style="height:92vh;">
<view class='pageContent'>
<text>超長的頁面內容</text>
</view>
<scroll-view scroll-y="true" style="height:92vh;">
<!-- 底部定位元素 -->
<view class='foot_cate'>
<button>立即支付</button>
</view>
.foot_cate {
position: absolute;
bottom: 0;
width: 100%;
background-color: #fff;
}
- 注:
將底部固定定位的元素改爲絕對定位,整個內容不超過整個頁面高度,將超出頁面滑動的部分包裹在 scroll-view 標籤中並縱向滑動,底部留出定位元素高度即可
,這樣滑動元素的高度不會達到底部定位元素,就不會浮出。
2、浮在彈框表層
- 解決
- 給textarea,input 增加 wx:if 判斷條件,當彈框顯示是控制 textarea,input 顯示條件爲 false 即可。