标签:回调 fun lang second comment line url var tor
App({
onLaunch: function(options) {
},
wxLogin() {
let that = this;
return new Promise((resolve, reject) => {
wx.request({
url: ‘www.xx.com‘,
success: function(res) {
that.globalData.web_name = ‘222‘
resolve(res.data)
}
})
})
},
globalData: {
web_name: ‘111‘
}
})
//index.js
const app = getApp()
Page({
data: {
},
onLoad(){
console.log(‘first:‘, app.globalData.web_name) //111
app.wxLogin().then(res => {
console.log(‘second:‘, app.globalData.web_name) //222
});
console.log(‘third:‘, app.globalData.web_name) //111
}
})
标签:回调 fun lang second comment line url var tor
原文地址:https://www.cnblogs.com/zimukong/p/13371228.html