zimukong
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
  }
})




分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-07-27
  • 2021-08-23
  • 2022-12-23
  • 2022-03-03
  • 2021-07-05
  • 2021-07-07
  • 2021-07-02
猜你喜欢
  • 2022-02-06
  • 2021-11-18
  • 2021-04-25
  • 2021-05-12
  • 2021-12-08
  • 2022-01-29
  • 2022-01-03
相关资源
相似解决方案