微信小程序—弹出框

1.消息提示——wx.showToast(OBJECT)

微信小程序—弹出框

//show.js
//获取应用实例
var app = getApp()
Page({
showok:function() {
wx.showToast({
title: ‘成功’,
icon: ‘success’,
duration: 2000
})
}
})

2.模态弹窗——wx.showModal(OBJECT)

微信小程序—弹出框

//show.js
//获取应用实例
var app = getApp()
Page({
modalcnt:function(){
wx.showModal({
title: ‘提示’,
content: ‘这是一个模态弹窗’,
success: function(res) {
if (res.confirm) {
console.log(‘用户点击确定’)
} else if (res.cancel) {
console.log(‘用户点击取消’)
}
}
})
}
})

3.操作菜单——wx.showActionSheet(OBJECT)

微信小程序—弹出框
//show.js
//获取应用实例
var app = getApp()
Page({
actioncnt:function(){
wx.showActionSheet({
itemList: [‘A’, ‘B’, ‘C’],
success: function(res) {
console.log(res.tapIndex)
},
fail: function(res) {
console.log(res.errMsg)
}
})
}
})