//app.js
App({
onLaunch: function (options) {
//设置场景值到缓存中:
//wx.setStorageSync("scene", options.scene);
//return ;
this.globalData.scene = options.scene;
},
globalData:{
scene:''
}
})
在页面中获取全局变量:
const app = getApp()
Page({
//进来加载页面:
onLoad(opts) {
var scene = app.globalData.scene;
}
}
})