微信小程序 拍照上传后台怎么写

如题所述

第1个回答  2017-12-13
<view>
<image src='{{upload}}' mode='widthFix' bindtap='uploadImg'></image>
</view>

js

page({
data:{
    uploadImg:'',
}
uploadImg:function(){
var that = this
    wx.chooseImage({
        count: 1,//表示只能穿一张
        that.setData({
        uploadImg: res.tempFilePaths,
        })
    })
}
})
//可以拍照 也可上传图片