微信小程序wx.showModal如何修改样式
1、打开桌面上的“微信Web开发者工具”,如下图所示:

3、手机上微信扫描2步骤的二维码,进行登陆,如下图所示:

5、选择“添加项目”,如下图所示:

7、为index.wxml藜局腑载添加如下图代码:<!--index.wxml--><button class="show-btn" bindtap="showDialogBtn">弹窗</button><!--弹窗--><view class="modal-mask" bindtap="hideModal" catchtouchmove="preventTouchMove" wx:if="{{showModal}}"></view><view class="modal-dialog" wx:if="{{showModal}}"> <view class="modal-title">添加数量</view> <view class="modal-content"> <view class="modal-input"> <input placeholder-class="input-holder" type="number" maxlength="10" bindinput="inputChange" class="input" placeholder="请输入数量"></input> </view> </view> <view class="modal-footer"> <view class="btn-cancel" bindtap="onCancel" data-status="cancel">取消</view> <view class="btn-confirm" bindtap="onConfirm" data-status="confirm">确定</view> </view></view>

9、index.js代码如下图所示://index.js//获取应用实例var app = getApp()Page({ data: { showModal: false, }, onLoad: function () { }, /** * 弹窗 */ showDialogBtn: function () { this.setData({ showModal: true }) }, /** * 弹出框蒙层截断touchmove事件 */ preventTouchMove: function () { }, /** * 隐藏模态对话框 */ hideModal: function () { this.setData({ showModal: false }); }, /** * 对话框取消按钮点击事件 */ onCancel: function () { this.hideModal(); }, /** * 对话框确认按钮点击事件 */ onConfirm: function () { this.hideModal(); }})
