小程序
小游戏
企业微信
微信支付
扫描小程序码分享
小程序camera组件 false控制闪光灯 在ios上调成自动没问题 但是在安卓机上调成自动失效怎么回事?
1 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
<camera mode="normal" device-position="{{devicePosition}}" flash="auto" style="width: 100%; height: 80vh;" binderror="error">
<cover-view class="controls">
<cover-image class="img" src="../../images/notice.png" style="width:100%; height:100%"/>
</cover-view>
<cover-view class="noticeTXT">请将XXX放入框内</cover-view>
</camera>
<button type="primary" bindtap="takePhoto">拍照</button>
<button type="primary" bindtap="reverseCamera">翻转</button>
<image mode="widthFix" src="{{src}}"></image>
// camera.js
Page({
data: {
devicePosition: 'back',
},
onReady() {
},
reverseCamera: function () {
this.setData({
devicePosition: "back" === this.data.devicePosition ? "front" : "back"
});
},
takePhoto() {
const ctx = wx.createCameraContext()
ctx.takePhoto({
quality: 'high',
success: (res) => {
this.setData({
src: res.tempImagePath
})
}
})
},
error(e) {
console.log(e.detail)
}
})