getApp()
The globalData () function is used to get the current application instance, typically globalData.
1. Uni-app defines globalData in app.vue file
export default {
globalData: {lists: [].datainfo: {}}},Copy the code
2. Other page references can be directly assigned
In other files it is called with getApp().globalData
getlevel4() {
this.$http({
url: ' '
}).then(res= > {
getApp().globalData.lists = res.data;
}).catch(err= >{})},Copy the code
3. Then you can also upload to other pages to directly call the assignment
onLoad(){
this.headerlist = getApp().globalData.lists; },Copy the code
$scope. GlobalData = this.$scope. GlobalData = this.$scope
To get it in another child page, use getApp().globalData