//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; } } })
欢迎光临 PHP开发笔记 (http://www.phpvi.com/) | Powered by Discuz! 6.1.0 |