<camera device-position="back" flash="off" binderror="error" style="width: 100%; height: 300px;"></camera>
<button type="primary" bindtap="takePhoto">拍照</button>
<view>预览</view>
<image mode="widthFix" src="{{src}}"></image>
 
 

takePhoto() {
  const ctx = wx.createCameraContext()
  ctx.takePhoto({
    quality: 'high',
    success: (res) => {
      this.setData({
        src: res.tempImagePath
      })
    }
  })
},

相关文章:

  • 2021-08-16
  • 2021-06-14
  • 2022-12-23
  • 2021-12-03
  • 2021-05-24
  • 2021-12-31
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-19
  • 2022-12-23
  • 2022-02-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案