WeChat Mini Programs global variable cross-page value?

problem description

defines the global variable userNum:null, in app.js by modifying the value of the global variable userNum in login.js, and then getting userNum, in another page, but its value is still null. Var app = getApp ();
is written on the page. It is said on the Internet that the value can be obtained, but it has not been obtained.

related codes

/ / Please paste the code text below (do not replace the code with pictures)
app.js

 globalData: {
    userInfo: null,
    userNum:null
    }

login.js

    app.globalData.userNum = username;  //
    console.log(app.globalData.userNum);   //

another page:

 wx.request({
      url: "...",   //()
      method: "GET",
      header: {
        "content-type": "application/json"
      },
      data: {
        stunum: app.globalData.userNum       //stunumnull
      },
      success: function(res) {
        console.log(res.data);
        }
        })
Apr.26,2021

is login.js an asynchronous operation?


it's okay to write this way, but there's a problem elsewhere in the file

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea85a0-1ecc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea85a0-1ecc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?