Cannot read property 'then' of undefined
来源:5-4 第五天 微信菜单-生成菜单
 
			2008wffty
2016-11-16
在weixin.js 的Line8调用wechatApi.deleteMenu()方法的时候,'.then()'就会报这个错误。一直想不通为何
写回答
	3回答
- 
				  Scott 2016-11-17 deleteMenu 方法内部是不是出错了,或者 deleteMenu 里面没有返回一个 Promise 00
- 
				  子佳麦兜 2017-05-20 Wechat.prototype.fetchAccessToken = function(data) { var that = this; if (this.access_token && this.expires_in) { if (this.isValidAccessToken(this)) { return Promise.resolve(this) } } return this.getAccessToken() .then(function(data) { try { data = JSON.parse(data); } catch(e) { return that.updateAccessToken(data); } if (that.isValidAccessToken(data)) { return Promise.resolve(data); } else { return that.updateAccessToken() } }) .then(function(data) { that.access_token = data.access_token; that.expires_in = data.expires_in; that.saveAccessToken(data) return Promise.resolve(data); }) }这个函数,在this.getAccessToken()前面加一个 return,就不报错了。 412017-08-16
- 
				  youai_student 2017-02-06 http://coding.imooc.com/learn/questiondetail/209.html 10
相似问题
 
						 
						