我也遇到同样的问题,不知是什么原因?@官方
Cant find variable:at request fail call1. result is not defined;at App post function;at api request fail callback function 2. Can't find variable: result;at pages/home/home requestHomeData function;at api request fail callback function 后台发现好多这种错误,都是 result is not defined at api request fail callback function,但是相应的 method 里面并没有任何 result,而且我确定所有的 result 都做了空判断,官方能指点指点吗? pages/home/home requestHomeData function: [代码]requestHomeData: [代码][代码]function[代码] [代码]() {[代码][代码] [代码][代码]let that = [代码][代码]this[代码][代码];[代码][代码] [代码][代码]wx.login({[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]res.code && app.post(Url.home, {city: that.data.currentCityName, code: res.code}).then(res => {[代码][代码] [代码][代码]res.data && that.handleHomeData(res.data);[代码][代码] [代码][代码]});[代码][代码] [代码][代码]}[代码][代码] [代码][代码]});[代码][代码] [代码][代码]},[代码] App post function: [代码]/**[代码][代码] [代码][代码]* 封装 post 请求为 Promise[代码][代码] [代码][代码]* @param url[代码][代码] [代码][代码]* @param data[代码][代码] [代码][代码]* @param header[代码][代码] [代码][代码]* @returns {*|Promise<any>}[代码][代码] [代码][代码]*/[代码][代码] [代码][代码]post: [代码][代码]function[代码] [代码](url, data, header = {}) {[代码][代码] [代码][代码]if[代码] [代码]([代码][代码]this[代码][代码].globalData.deviceSerialNumber) {[代码][代码] [代码][代码]header = {...header, [代码][代码]'device-serial-number'[代码][代码]: [代码][代码]this[代码][代码].globalData.deviceSerialNumber};[代码][代码] [代码][代码]}[代码][代码] [代码][代码]return[代码] [代码]url && data && [代码][代码]new[代码] [代码]Promise((resolve, reject) => {[代码][代码] [代码][代码]wx.request({[代码][代码] [代码][代码]url: url,[代码][代码] [代码][代码]method: [代码][代码]'POST'[代码][代码],[代码][代码] [代码][代码]data: data,[代码][代码] [代码][代码]header: {[代码][代码] [代码][代码]'content-type'[代码][代码]: [代码][代码]'application/json'[代码][代码], [代码][代码]// 微信默认就是[代码][代码] [代码][代码]...header[代码][代码] [代码][代码]},[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]resolve(res);[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]reject(res);[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]});[代码][代码] [代码][代码]},[代码]
2018-07-04