非app.js的页面:
var app = getApp(); app.globalData.userName = "xxx";
app.js:
在onLaunch函数中:(var that = this;必须写在onlaunch()开始)
onLaunch: function () {
var that = this; that.globalData.userName = "xxx"; },
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/219345.html原文链接:https://javaforall.net
