在globalData定议了属性但读取的时候问题是报错
app.js
globalData: {
userInfo: null,
APIUrl:“aaaa”
}
index.js
var app = getApp()
Page({
data: {
},
onLoad: function() {
var dd = app.gloabData.APIUrl;
console.log(‘123’+dd);
},
})
总是报:
VM89:1 thirdScriptError
Cannot read property ‘APIUrl’ of undefined;at pages/index/index page lifeCycleMethod onLoad function
TypeError: Cannot read property ‘APIUrl’ of undefined