<view class="img-view">
<image src="images/1.png" class="img"></image>
</view>
這個(gè)View平時(shí)不顯示,當(dāng)按住button 的時(shí)候,顯示到屏幕中央,位于其他所有組件之上。
網(wǎng)友回復(fù):
z-index; position:fixed;
樣式的問(wèn)題咯。
<view class="img-view" style="z-index:{{rangeNumer}}">
<image src="images/1.png" class="img"></image>
</view>
點(diǎn)擊按鈕的時(shí)候改變r(jià)angeNumber,然后在存到data中就可以了。
使用CSS的定位:先使用 固定定位(fixed)或者絕對(duì)定位(absolute)都可以實(shí)現(xiàn)。再搭配 z-index 實(shí)現(xiàn)。
謝謝大家
<view class="container">
<scroll-view>
<view class="scscsc"></view>
</scroll-view>
<view class="imgview">
<image class="iimmgg" src="3.png"></image>
</view>
</view>
.iimmgg{
width: 200rpx;
height: 200rpx;
}
.imgview{
position: fixed;
z-index: 99;
}
.scscsc{
position: fixed;
z-index: 1;
width:100%;
height: 300rpx;
background-color: #ffff00;
}