wx.showActionSheet-​显示操作菜单

显示操作菜单

OBJECT参数说明:

参数类型必填说明
itemListString Array按钮的文字数组,数组长度最大为6个
itemColorHexColor按钮的文字颜色,默认为"#000000"
successFunction接口调用成功的回调函数,详见返回参数说明
failFunction接口调用失败的回调函数
completeFunction接口调用结束的回调函数(调用成功、失败都会执行)

success返回参数说明:

参数类型说明
tapIndexNumber用户点击的按钮,从上到下的顺序,从0开始

示例代码:

wx.showActionSheet({
itemList: ['第一个', '第二个', '第三个'],
success: function (res) {
console.log(res.tapIndex)
},
fail: function (res) {
console.log(res.errMsg)
}
});

Bug & Tip

bug:Android6.3.30,wx.showModal 的返回的 confirm 一直为 true;

tip: wx.showActionSheet 点击取消或蒙层时,回调fail, errMsg 为 "showActionSheet:fail cancel";

tip: wx.showLoading 和 wx.showToast 同时只能显示一个,使用 wx.hideToast/wx.hideLoading 都可以关闭提示框;

tipiOS wx.showModal 点击蒙层不会关闭模态弹窗,所以尽量避免使用“取消”分支中实现业务逻辑。