小程序 彈框wx.showToast、wx.showModal、wx.showActionSheet

@小程序 彈框wx.showToast、wx.showModal、wx.showActionSheet

一、wx.showToast

wx.showToast({
         title: '失敗',//提示文字
         duration:2000,//顯示時長
         mask:true,//是否顯示透明蒙層,防止觸摸穿透,默認:false  
         icon:'success', //圖標,支持"success"、"loading"  
         success:function(){ },//接口調用成功
         fail: function () { },  //接口調用失敗的回調函數  
         complete: function () { } //接口調用結束的回調函數  
      })

二、wx.showModal

wx.showModal({
         title: '刪除圖片',
         content: '確定要刪除該圖片?',
         showCancel: true,//是否顯示取消按鈕
         cancelText:"否",//默認是“取消”
         cancelColor:'skyblue',//取消文字的顏色
         confirmText:"是",//默認是“確定”
         confirmColor: 'skyblue',//確定文字的顏色
         success: function (res) {
            if (res.cancel) {
               //點擊取消,默認隱藏彈框
            } else {
               //點擊確定
               temp.splice(index, 1),
               that.setData({
                  tempFilePaths: temp,
               })
            }
         },
         fail: function (res) { },//接口調用失敗的回調函數
         complete: function (res) { },//接口調用結束的回調函數(調用成功、失敗都會執行)
      })

三、wx.showActionSheet

	   wx.showActionSheet({
	         itemList: ['列1','列2','列3'],//顯示的列表項
	         success: function (res) {//res.tapIndex點擊的列表項
	            console.log("點擊了列表項:" + that[res.tapIndex])
	         },
	         fail: function (res) { },
	         complete:function(res){ }
	      })
	   ```
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章