微信小程序自定義彈框效果
更新時(shí)間:2022年07月07日 13:36:33 作者:asteriaV
這篇文章主要為大家詳細(xì)介紹了微信小程序自定義彈框效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
本文實(shí)例為大家分享了微信小程序自定義彈框效果的具體代碼,供大家參考,具體內(nèi)容如下
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="請(qǐng)輸入其他原因"></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; }
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
您可能感興趣的文章:
- 微信小程序自定義Dialog彈框
- 微信小程序?qū)崿F(xiàn)簡(jiǎn)單彈框效果
- 微信小程序開(kāi)發(fā)實(shí)現(xiàn)首頁(yè)彈框活動(dòng)引導(dǎo)功能
- 微信小程序?qū)崿F(xiàn)自定義動(dòng)畫(huà)彈框/提示框的方法實(shí)例
- 微信小程序?qū)崿F(xiàn)彈框效果
- 微信小程序之幾種常見(jiàn)的彈框提示信息實(shí)現(xiàn)詳解
- 微信小程序開(kāi)發(fā)之實(shí)現(xiàn)自定義Toast彈框
- 微信小程序開(kāi)發(fā)之toast等彈框提示使用教程
- 微信小程序 modal彈框組件詳解
- 微信小程序自定義Modal彈框
相關(guān)文章
bootstrap fileinput 插件使用項(xiàng)目總結(jié)(經(jīng)驗(yàn))
這篇文章主要介紹了bootstrap fileinput 插件使用項(xiàng)目總結(jié),是小編日常碰到的問(wèn)題及解決方法,需要的朋友可以參考下2017-02-02JS 對(duì)象屬性相關(guān)(檢查屬性、枚舉屬性等)
這篇文章主要介紹了JS 對(duì)象屬性相關(guān)(檢查屬性、枚舉屬性等),需要的朋友可以參考下2015-04-04JavaScript中常用的數(shù)組操作方法總結(jié)
這篇文章為大家總結(jié)了一些JavaScript中常用的數(shù)組操作方法,文中通過(guò)示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2022-07-07