小程序弹出评论框,以及其遮罩效果实现

wxml:

<scroll-view scroll-y="{{isScroll}}">
...
<!-- 评论框 -->
<view class='model' wx:if="{{inputBoxShow}}">
<!-- invisible_model view 用于点击隐藏model评论框 -->
<view class='invisible_model' catchtap='invisible'></view>
<view class='input-box'>
<textarea class="textarea" placeholder="请输入你的看法" cursor-spacing="{{65}}" show-confirm-bar="{{false}}" adjust-position="{{true}}" auto-focus="{{true}}" />
<text class='send'>发送</text>
</view>
</view>
...
</scroll-view>

wxss:

.model {
position: fixed;
width: 100vw;
height: 100vh;
top: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.4);
z-index: 100;
}

.input-box {
position: absolute;
background-color: #f8f8f8;
padding: 30rpx;
padding-bottom: 130rpx;
bottom: 0;
left: 0;
right: 0;
z-index: 101;
}

.textarea {
background-color: #fff;
width: 100%;
padding: 5rpx;
height: 3.3em;
font-size: 15px;
position: static;
}

.send {
font-size: 14px;
margin-top: 5rpx;
color: #09bb07;
float: right;
position: static;
}

.invisible_model{
position: fixed;
width: 100vw;
height: 100vh;
top: 0;
bottom: 0;
}

js:

Page({
data: {
inputBoxShow: false,
isScroll: true,
},
showInputBox: function () {
this.setData({ inputBoxShow: true });
this.setData({ isScroll: false });
},
invisible: function(){
this.setData({ inputBoxShow: false });
this.setData({ isScroll: true });
}
})

转载于:https://www.cnblogs.com/linwene/p/9894878.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值