The value returned by a method of WeChat Mini Programs in util is empty.

Util in

WeChat Mini Programs has a function that takes a value in storage and returns it, which can be printed. However, the value returned is empty

.

Util.js

function get_user_info(){
    wx.getStorage({
            key : "user_info",
            success:function(data){
            // 
                console.log(data.data)
                return data.data
            },
            fail:function(res){
                console.log(""+res.errMsg)
            }
        })
  }

another called page print:

console.log(Util.get_user_info())
undefined



use promise, or wx.getStorageSync

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-1b323dd-341c5.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-1b323dd-341c5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?