微信小程序?qū)崿F(xiàn)蒙版彈窗效果
更新時間:2018年11月01日 08:36:47 作者:煥想
這篇文章主要為大家詳細(xì)介紹了微信小程序?qū)崿F(xiàn)蒙版彈窗效果,具有一定的參考價值,感興趣的小伙伴們可以參考一下
本文實例為大家分享了微信小程序?qū)崿F(xiàn)蒙版彈窗效果的具體代碼,供大家參考,具體內(nèi)容如下
<view class="modalDlg" wx:if="{{showModal}}">
<view class='close_mask' bindtap="close_mask">X</view>
<input class='recharge_amount' type='text' placeholder='充值金額' maxlength="8" value='{{recharge_amount}}'></input>
<button class='save_money' type='submit'>立即充值</button>
</view>
<button class='recharge' bindtap="submit">充值</button>
<view class="mask" catchtouchmove="preventTouchMove" wx:if="{{showModal}}"></view>
js:
// 點擊充值彈窗
submit: function () {
this.setData({
showModal: true
})
},
preventTouchMove: function () {
},
close_mask: function () {
this.setData({
showModal: false
})
},
CSS:
/* 點擊充值彈窗 */
.mask {
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
background: #000;
z-index: 9000;
opacity: 0.7;
}
.modalDlg {
width: 580rpx;
height: 450rpx;
position: fixed;
top: 50%;
left: 0;
z-index: 9999;
margin: -370rpx 85rpx;
background-color: #fff;
border-radius: 36rpx;
display: flex;
flex-direction: column;
align-items: center;
}
.recharge_amount {
color: #aaa;
width: 450rpx;
height: 80rpx;
background: #f1f1f1;
text-align: center;
border-radius: 12rpx;
margin-top: 56rpx;
text-indent: 0;
}
.save_money {
color: #fff;
width: 270rpx;
height: 80rpx;
line-height: 80rpx;
background: #d95155;
text-align: center;
border-radius: 12rpx;
margin-top: 80rpx;
font-size: 28rpx;
text-indent: 0em;
}
.close_mask {
color: #000;
position: relative;
left: 40%;
/* top: -82%; */
font-size: 32rpx;
}
/*彈窗結(jié)束 */
效果圖:

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
JavaScript高級程序設(shè)計 閱讀筆記(十八) js跨平臺的事件
js跨平臺的事件經(jīng)驗分享,需要的朋友可以參考下2012-08-08
微信小程序?qū)崿F(xiàn)通過js操作wxml的wxss屬性示例
這篇文章主要介紹了微信小程序?qū)崿F(xiàn)通過js操作wxml的wxss屬性,結(jié)合實例形式分析了微信小程序使用js操作wxml的wxss屬性相關(guān)原理、實現(xiàn)技巧與操作注意事項,需要的朋友可以參考下2018-12-12
通過設(shè)置CSS中的position屬性來固定層的位置
position 屬性規(guī)定元素的定位類型,這個屬性定義建立元素布局所用的定位機制,本文給大家介紹通過設(shè)置CSS中的position屬性來固定層的位置,感興趣的朋友一起學(xué)習(xí)吧2015-12-12

