一、提示框
wx.showToast({
title: '刷新成功',//提示文字
duration:2000,//顯示時長
mask:true,//是否顯示透明蒙層,防止觸摸穿透,默認:false
icon:'success', //圖標,支持"success"、"loading"
success:function(){ },//接口調用成功
fail: function () { }, //接口調用失敗的回調函數
complete: function () { } //接口調用結束的回調函數
})
效果展示:
二、選擇框
wx.showModal({
title: '用戶登錄',
content: '確定使用微信賬號登錄?',
showCancel: true,//是否顯示取消按鈕
cancelText: "取消",//默認是“取消”
cancelColor: '#DEB887',//取消文字的顏色
confirmText: "確定",//默認是“確定”
confirmColor: '#DEB887',//確定文字的顏色
success: function (res) {
if (res.cancel) {
//點擊取消,默認隱藏彈框
} else {
//點擊確定
temp.splice(index, 1),
that.setData({
tempFilePaths: temp,
})
}
},
fail: function (res) { },//接口調用失敗的回調函數
complete: function (res) { },//接口調用結束的回調函數(調用成功、失敗都會執行)
})
效果展示:
三、選擇菜單:
wx.showActionSheet({
itemList: ['點贊', '收藏', '看過'],//顯示的列表項
success: function (res) {//res.tapIndex點擊的列表項
console.log("點擊了列表項:" + that[res.tapIndex])
},
fail: function (res) { },
complete:function(res){ }
})
效果展示: