没有合适的资源?快使用搜索试试~ 我知道了~
首页微信小程序使用前置摄像头拍照
本文实例为大家分享了微信小程序使用前置摄像头拍照的具体代码,供大家参考,具体内容如下 1、拍照页面: <template> <view title=拍照> <camera v-if=openCamera device-position=front frame-size=large class=zipai error=error> </camera> <cover src=/static/image/renzheng_zz.png class=zhezhao></cover> <cover-view class=wenzi
资源详情
资源评论
资源推荐

微信小程序使用前置摄像头拍照微信小程序使用前置摄像头拍照
本文实例为大家分享了微信小程序使用前置摄像头拍照的具体代码,供大家参考,具体内容如下
1、拍照页面:
<template>
<view title="拍照">
<camera v-if="openCamera" device-position="front" frame-size="large" class="zipai" @error="error"> </camera>
<cover-image src="/static/image/renzheng_zz.png" class="zhezhao"></cover-image>
<cover-view class="wenzi fint34">请将正面人脸放在识别框中,进行拍摄</cover-view>
<cover-image class="paizhao" src="/static/image/renzheng_pz.png" @click="takePhoto"></cover-image>
</view>
</template>
<script>
export default {
data() {
return {
openCamera:true
}
},
methods: {
takePhoto() {
const ctx = wx.createCameraContext()
ctx.takePhoto({
quality: 'high',
success: (res) => {
let tempFilePath = res.tempImagePath
uni.navigateTo({
url:'/pages/renzhengwxtu/renzhengwxtu?src='+tempFilePath
})
}
})
},
//用户拒绝授权摄像头
error(e) {
this.openCamera=false
wx.showModal({
title: '警告',
content: '若不授权使用摄像头,将无法使用拍照功能!',
cancelText: '不授权',
cancelColor: '#1ba9ba',


















安全验证
文档复制为VIP权益,开通VIP直接复制

评论0