gt;请上传图片</view>
<view class="container">
<image wx:for="{{imageList}}" src="{{item}}"></image>
</view>
js data: {
imageList: ["/static/hg.jpg", "/static/hg.jpg"]
},
uploadImage:function(){
var that = this;
wx.chooseImage({
count:9, //图片最多的个数
sizeType: ['original', 'compressed'], // 图片大小
sourceType: ['album', 'camera'], //图片的来源,相机或者本地
success:function(res){
// 设置imageList,页面上图片自动修改。
// that.setData({
// imageList: res.tempFilePaths
// });
// 默认图片 + 选择的图片;
that.setData({
imageList: that.data.imageList.concat(res.tempFilePaths) //concat方法拼接两个列表
});
}
});
},
注意:图片目前只是上传到了内存。
|