小程序点击添加图片

偶尔善良 提交于 2020-01-28 12:18:56

 

wxml:

<view class="uPic">
<view class="tit">头像:</view>
<view class=""><image src="{{imageList}}" class="uPicimg" mode="scaleToFill" bindtap="chooseImg"></image></view>
</view>

wxss:此处省略样式代码!!!!

 js:

chooseImg:function () {
var that = this
wx.chooseImage({
sourceType: sourceType[this.data.sourceTypeIndex],
sizeType: sizeType[this.data.sizeTypeIndex],
success: function(res) {
var tempFilePaths = res.tempFilePaths[0]
console.log(res.tempFilePaths)
that.setData({imageList: res.tempFilePaths[0]})
}
})
},

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!