camera组件使用前置摄像头拍照,文字镜像
机型:iPhone8,微信:6.5.22+6.5.23;
机型:小米3 ,微信:6.5.22;
以上机型均测试过。还有部分iPhone也有同样问题,不一一列举。都是如下图问题。代码如下。
已经第二次发帖了,邮件也发过,但是一直没得到回复,目前项目就卡在这里了,忘微信团队能尽快解决。感谢
<!--index.wxml--> < camera device-position = "front" flash = "off" binderror = "error" style = "width: 100%; height: 300px;" ></ camera > < button type = "primary" bindtap = "takePhote" >拍照</ button > < view >预览</ view > < image mode = "widthFix" src = "{{src}}" ></ image > |
//index.js //获取应用实例 const app = getApp() Page({ data: { src: '' }, takePhote: function (){ let that = this ; const ctx = wx.createCameraContext() ctx.takePhoto({ quality: 'high' , success: function (res) { console.log(res) that.setData({ src: res.tempImagePath }) } }) }, onLoad: function () { } }) |