- tempFilePaths 可以作为img 标签的src 属性显示图片
<image src="{{imgUrl}}"></image>
<button bindtap="chosseImage">选择图片</button>
chosseImage() {
wx.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: (res) => {
const tempFilePaths = res.tempFilePaths
this.setData({
imgUrl: tempFilePaths
})
}
})