小程序上传图本地片wx.chooseImage

 

 效果如上图所示

		<view class="idcard-upload" bindtap='idcardFan'>
	 <image src="{
   
   {idfan}}"  class="img"></image>
		</view>
  data: {
   
    idfan:'../image/加号.png',

  },

  idcardFan:function(e){
    var that=this;
    wx.chooseImage({
      count: 1,
      sizeType: ['original', 'compressed'],
      sourceType: ['album', 'camera'],
      success (res) {
        const tempFilePaths = res.tempFilePaths
        that.setData({
          idfan: tempFilePaths[0]
        })
      }
    })
  },

猜你喜欢

转载自blog.csdn.net/weixin_38959210/article/details/107600738