微信小程序使用wx.showtoast后面代碼不執行


if (res.statusCode === 200) {
                wx.showToast({
                    title: '保存成功',
                })
                console.log('保存成功')
                console.log('重新獲取數據')
                console.log(res.data.bx_id)
                this.searchBx(res.data.bx_id)
            }

原來代碼

this.searchBx(res.data.bx_id)沒有執行



修改后:

if (res.statusCode === 200) {
                var that = this
                wx.showToast({
                    title: '保存成功',
                    success() {
                        console.log('保存成功')
                        console.log('重新獲取數據')
                        console.log(res.data.bx_id)
                        that.searchBx(res.data.bx_id)
                    }
                })
            }

順利執行


介紹:

 wx.showToast({
       title:"成功",
       icon: 'loading...',//圖標,支持"success"、"loading" 
       image: '/images/tan.png',//自定義圖標的本地路徑,image 的優先級高於 icon
       duration: 2000,//提示的延遲時間,單位毫秒,默認:1500 
       mask: false,//是否顯示透明蒙層,防止觸摸穿透,默認:false 
       success:function(){},
       fail:function(){},
       complete:function(){}
     })
  },

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM