app.js中设置了全局变量,但调用 getApp()时得到的值为undefined?
// app.js App({ globalDatad: { indexs: -1, }, onLaunch() { }, }) index中调用的过程 handeTypeJump(e){ console.log(e); const {index} = e.currentTarget.dataset; console.log(index); const app = getApp(); setTimeout(function () { const app = getApp(); console.log("App="+app) app.globalDatad.index = index },2000) // wx.switchTab({ // url: '/pages/category/index' // }) }, 报错 [图片]