we.getUserInfo
发布于 5 年前 作者 ylu 4825 次浏览 来自 问答

wx.login({

    success: function (e) {

        console.log(e)

        wx.getUserInfo({

            success: function (res) {

            var simpleUser = res.userInfo;

                console.log(simpleUser.nickName);

            },

            fail:function(res){

                console.log(res)

            }

        });

    },

    fail:function(e){

    console.log(e)

    }

});

输出为:{errMsg: “login:ok”, code: “071C7ucn1AvRqk0rFKdn1l2xcn1C7uct”}和{errMsg: “getUserInfo:fail scope unauthorized”}

回到顶部