There are the following statements in WxService:
class Service {
....没有找到login和getUserInfo的定义
}
export default Service
There are the following statements in app.js:
import WxService from 'helpers/WxService'
APP({
WxService: new WxService,
getUserInfo() {
return this.WxService.login()
.then(data => {
console.log(data)
return this.WxService.getUserInfo()
})
.then(data => {
console.log(data)
this.globalData.userInfo = data.userInfo
return this.globalData.userInfo
})
},
})
Why can this.WxService.login() and this.WxService.getUserInfo() be executed?
Thanks for the invitation.
This.WxService is the object packaged by WeChat and is hidden from the outside world.
ps: In addition, WeChat has its own protocol weixin:// similar to http://
this.WxService is the object packaged by Weixin
https://mp.weixin.qq.com/debu...