微信小程式 錯誤記錄

2022-04-08 10:11:53 字數 668 閱讀 6536

1、報錯this.getuserinfo(this.setdata) is not a function;at pages/index/index onshow function;at api request success callback function

typeerror: this.getuserinfo is not a function

在**結果裡呼叫這個頁面的函式 this.fun() 或者 this.setdata 時就會報錯,這時要在函式一開時的地方使用var that = this;,然後使用that呼叫資料。

這裡的this指向的就是請求本身了如( wx.request ),而不是這個頁面!!!

onload:function(options),

login:function()裡資料時候setdata方法的this應為以及函式的this, 如果在下方的sucess直接寫this就變成了wx.request()的this了

wx.login(,

success: function (re) );//如果在sucess直接寫this就變成了wx.request()的this了.必須為getdata函式的this,不然無法重置呼叫函式}})

} else }})

},getuserinfo: function () ,

微信退款失敗錯誤記錄

1,curl setopt ch curlopt ssl verifypeer,false 一定要這是為false,curl預設對所有伺服器不信任,設定為true是curl會提示 ssl certificate problem unable to get local issuer certifica...

微信小程式錯誤日誌思考

let errorlimit false 系統錯誤捕獲 const errorhandler err,vm,info 執行報錯 if errorlimit let errobjreport errorlimit true try catch err apijserrsendmsg then res ...

微信小程式常用api記錄

頁面跳轉 跳轉到新頁面 跳轉到新頁面 關閉當前頁面,跳轉到應用內的某個頁面。跳轉 go 接收傳到的引數 onload function options 獲取地理位置 wx.getlocation 呼叫掃一掃 wx.scancode 獲取使用者資訊 wx.getuserinfo wx.request ...