在WxService中有下列語句:
class Service {
....没有找到login和getUserInfo的定义
}
export default Service
在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
})
},
})
為什麼可以執行this.WxService.login()和this.WxService.getUserInfo()?
謝邀。
this.WxService是微信封裝的對象,對外是隱藏的。
ps:另外微信還有自己的協定weixin://類似http://
this.WxService是微信封裝的物件
https://mp.weixin.qq.com/debu...