uni-app微信小程序獲取用戶頭像并保存
methods中使用方法
獲取微信用戶名稱(chēng) onKeyInput: function(event) { this.nickname = event.target.value },
獲取頭像并且轉(zhuǎn)換成Base64 onChooseAvatar(e) { let imgBase64 = wx.getFileSystemManager().readFileSync(e.detail.avatarUrl, 'base64'); let background = 'data:image/png;base64,' + imgBase64; this.avatarUrl = background },