小程序点击添加图片

 

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]})
}
})
},

 

posted @ 2017-05-16 14:13  AF_MANON  阅读(4284)  评论(0编辑  收藏  举报