更新记录

1.0.0(2021-05-26)

发布


平台兼容性

Vue2 Vue3
×
App 快应用 微信小程序 支付宝小程序 百度小程序 字节小程序 QQ小程序
× × × × × × ×
钉钉小程序 快手小程序 飞书小程序 京东小程序
× × × ×
H5-Safari Android Browser 微信浏览器(Android) QQ浏览器(Android) Chrome IE Edge Firefox PC-Safari
× × × × ×

PC-拍照

通过调用电脑的摄像头,生成图片

兼容性

查看兼容性

使用方式

在页面引入

<!-- 在项目中调起拍照功能 -->
<button @click="Init">PC拍照</button>

<!-- 不用插槽 -->
<pc-photo ref="pcPhoto" @send="send"></pc-photo>
<!-- 使用插槽 -->
<pc-photo ref="pcPhoto" @send="send">
  <view>
    <button @click="closePhoto">取消</button>
    <button @click="takePhoto">拍摄</button>
    <button @click="send">获取</button>
    <button @click="retake">重拍</button>
  </view>
</pc-photo>
import pcPhoto from '@/components/pc-photo/pc-photo.vue'

export default {
  components: {pcPhoto},
  methods: {
    // 初始化
    Init() {
      this.$refs.pcPhoto.Init()
    },
    // 拍摄
    takePhoto() {
      this.$refs.pcPhoto.takePhoto()
    },
    // 关闭摄像头
    closePhoto() {
      this.$refs.pcPhoto.close()
    },
    // 重新拍照
    retake() {
      this.$refs.pcPhoto.cancal()
    },
    // 获取照片-base64
    send(img) {
      console.log(img)
    }
  }
}

隐私、权限声明

1. 本插件需要申请的系统权限列表:

需要浏览器视频授权

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

插件不采集任何数据

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

MIT协议

暂无用户评论。

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问