微信小程序自定义弹框效果
更新时间:2022年07月07日 13:36:33 作者:asteriaV
这篇文章主要为大家详细介绍了微信小程序自定义弹框效果,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
本文实例为大家分享了微信小程序自定义弹框效果的具体代码,供大家参考,具体内容如下
wxml
<!-- 取消订单按钮 --> <view class="cancelBtn" bindtap="cancelOrder" data-id="{{item.id}}" data-type="{{type}}">取消订单</view> <!-- 取消订单弹框 --> <view class="modalDlg-mask" wx:if="{{showModal}}"></view> <view class="modalDlg" wx:if="{{showModal}}"> <view class="page-body"> <form bindsubmit="submit"> <view class="modalDlg-title"> <text>取消订单原因</text> </view> <view class="modalDlg-content"> <view class="modalDlg-content-item"> <radio-group bindchange="radioChange"> <label class="weui-cell weui-check__label" wx:for="{{items}}" wx:key="index"> <view class="weui-cell__hd"> <radio value="{{item.value}}" color="#ff5155" /> </view> <view wx:if="{{item.value!=='3'}}" class="weui-cell__bd">{{item.name}}</view> <text wx:if="{{item.value==='3'}}" style="width:150rpx;">{{item.name}}</text> <textarea wx:if="{{item.value==='3'}}" bindinput="bindTextArea" auto-height="true" placeholder="请输入其他原因"></textarea> </label> </radio-group> </view> </view> <view class="modalDlg-footer"> <view bindtap="closeModal" class="modalDlg-btn closeBtn">取消</view> <view bindtap="confirmModal" form-type="submit" class="modalDlg-btn confirmBtn">确定</view> </view> </form> </view> </view>
js
data:{ showModal: false, //取消订单弹框 } , //取消订单弹框 cancelOrder() { this.setData({ showModal: true }) }, //取消订单弹框-确定 confirmModal() { this.setData({ showModal: false }); }, //取消订单弹框-取消 closeModal() { this.setData({ showModal: false }) },
wxss
/* 取消订单弹框 */ .page-body { width: 100%; } /* 遮罩层 */ .modalDlg-mask { width: 100%; height: 100%; position: fixed; top: 0; left: 0; background: #000; z-index: 9000; opacity: 0.5; } /* 弹出层 */ .modalDlg { width: 70%; position: fixed; top: 25%; left: 0; right: 0; z-index: 9999; margin: 0 auto; background-color: #fff; border-radius: 5px; display: flex; flex-direction: column; align-items: center; } .modalDlg-title{ width: 100%; display: flex; align-items: center; justify-content: center; padding: 20rpx 0rpx; } .modalDlg-content { width: 100%; display: flex; flex-direction: column; justify-content: center; padding: 10rpx 0; } .modalDlg-content .modalDlg-content-item{ display: flex; align-items: center; justify-content: space-between; } .modalDlg-content .modalDlg-content-item radio-group{ width: 100%; color: #666; } .modalDlg-content .modalDlg-content-item .weui-check__label{ display: flex; align-items: center; } .modalDlg-content .modalDlg-content-item .weui-cell__bd{ line-height: 48rpx; } .modalDlg-content .modalDlg-content-item .weui-cell{ padding: 20rpx; display: flex; flex-direction: row; } .modalDlg-footer { width: 100%; height: 100rpx; border-top: 1rpx solid #ededed; display: flex; align-items: center; flex-wrap: nowrap; justify-content: space-between; } /* 弹出层里面的文字 */ .modalDlg .modalDlg-content text { text-align: justify; font-size: 28rpx; color: #666; /* margin-left: 10px; */ } /* 弹出层里面的按钮 */ .modalDlg-btn { width: 80px; height: 70rpx; line-height: 70rpx; text-align: center; font-size: 28rpx; border-radius: 40rpx; margin: 0 auto; } .modalDlg .modalDlg-footer .closeBtn { background: #fff; color: #fc4141; border: 1rpx solid #fc4141; } .modalDlg .modalDlg-footer .confirmBtn { background: #fc4141; color: #fff; }
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。
相关文章
JS、jquery实现几分钟前、几小时前、几天前等时间差显示效果的代码实例分享
在新浪微博首页看到每条微博后边显示的时间并不是标准的年-月-日格式,而是经过换算的时间差,如:发表于5分钟前、发表于“2小时前”,比起标准的时间显示格式,貌似更加直观和人性化2014-04-04
最新评论