wx.getUserInfo
({
success: function(res)
{ console.log('獲取用戶信息成功'); },
fail: function(e)
{ console.log("獲取用戶信息失敗 + " + JSON.stringify(e)); }
)}
總出現 fail 且 說沒授權,
wx.openSetting({})打開設置,沒出現授權框。
解決方法 打開.wxml
添加
<button open-type='getUserInfo'>獲取授權</button>