develop
jscyl13849007907 12 months ago
parent f11b9ee68d
commit 4061ad6e59

@ -76,7 +76,23 @@ Page({
});
},
});
},
},
chooseAnImage() {
const that = this;
wx.chooseMedia({
sizeType: ["original"], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ["album", "camera"], // 可以指定来源是相册还是相机,默认二者都有
success(res) {
// 返回选定照片的本地文件路径列表tempFilePath可以作为img标签的src属性显示图片
console.log(res);
that.setData({
files: that.data.files.concat(res.tempFilePaths),
temporaryImg: res.tempFiles[0].tempFilePath,
isSure: true,
});
},
});
},
changeUserImgsrc: function () {
var that = this;
// wx.chooseImage({

@ -14,8 +14,10 @@
<!-- bindtap='chooseImage'
<button wx:else open-type="chooseAvatar" style='' bindchooseavatar='choiceAvatar' class="change weui-btn_primary fw500 mt32" aria-role="button">更换头像</button>
-->
<!-- #if MP || ANDROID -->
<!-- #if MP -->
<button wx:else open-type="chooseAvatar" bindchooseavatar='choiceAvatar' class="change weui-btn_primary fw500 mt32" aria-role="button">更换头像</button>
<!-- #elif ANDROID -->
<button wx:else open-type="chooseAvatar" bindtap='chooseAnImage' class="change weui-btn_primary fw500 mt32" aria-role="button">更换头像</button>
<!-- #elif IOS -->
<button wx:else bindtap='chooseImage' class="change weui-btn_primary fw500 mt32" aria-role="button">更换头像</button>
<!-- #endif -->

Loading…
Cancel
Save