WeChat applet uses wx.showtoast and the code behind does not execute

if (res.statusCode === 200 ) { 
                wx.showToast ({ 
                    title: 'Save Successful' , 
                }) 
                console.log ( 'Save Successful' ) 
                console.log ( 'Retrieve Data' ) 
                console.log (res. data.bx_id) 
                this .searchBx (res.data.bx_id) 
            }

Original code

this .searchBx (res.data.bx_id) is not executed



After modification:

if (res.statusCode === 200 ) {
                 var that = this 
                wx.showToast ({ 
                    title: 'Save Successful' , 
                    success () { 
                        console.log ( 'Save Successful' ) 
                        console.log ( 'Retrieve Data' ) 
                        console.log (res.data.bx_id) 
                        that.searchBx (res.data.bx_id) 
                    } 
                }) 
            }

Smooth execution


Introduction:

wx.showToast ({ 
       title: "Success" , 
       icon: 'loading ...', // Icon, support "success", "loading" 
       image: '/images/tan.png', // Local custom icon Path, the priority of image is higher than icon 
       duration: 2000, // Delay time of prompt, in milliseconds, default: 1500 
       mask: false , // Whether to display a transparent mask to prevent touch penetration, default: false 
       success: function ( ) {}, 
       fail: function () {}, 
       complete: function () {} 
     }) 
  },

 

Guess you like

Origin www.cnblogs.com/xia-feng/p/12672372.html