这里对微信小程序中 modal组件进行详细解析,我想开发微信小程序的小伙伴可以用到,这里小编就记录下modal的知识要点。
modal
modal类似于javascript中的confirm弹框,默认情况下是一个带有确认取消的弹框,不过点击取消后弹框不会自动隐藏,需要通过触发事件调用函数来控制hidden属性。
官方文档
.wxml
<modal hidden="{{hidden}}" title="这里是title" confirm-text="自定义确定按钮" cancel-text="自定义取消按钮" bindcancel="cancel" bindconfirm="confirm" no-cancel="{{nocancel}}"> 这是对话框的内容。 </modal>
.js
Page({ data:{ hidden:false, nocancel:false }, cancel: function(){ this.setData({ hidden: true }); }, confirm: function(){ this.setData({ nocancel: !this.data.nocancel }); console.log("clicked confirm"); } })
运行效果
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
您可能感兴趣的文章:
- 微信小程序开发之实现自定义Toast弹框
- 微信小程序开发之toast等弹框提示使用教程
- 微信小程序 弹框和模态框实现代码
- 微信小程序的开发范式BeautyWe.js入门详解
- 微信小程序把百度地图坐标转换成腾讯地图坐标过程详解
- 微信小程序在ios下Echarts图表不能滑动的问题解决
- 微信小程序自定义弹窗实现详解(可通用)
- 微信小程序之几种常见的弹框提示信息实现详解