Skip to content

拍照 ​

方法名 ​

takePicture

用法 ​

示例 ​

js
if (this.$refs.refLevenUvcMultiCamera) {
  this.$refs.refLevenUvcMultiCamera.takePicture({
    type: type,
    //水印,不添加水印可以不用传此参数
    waterMarker: [{
      //水印内容
      text: "这是一条测试水印",
      //文本颜色,默认:白色
      color: "#FFFFFF",
      //文本大小,默认:20
      textSize: 40,
      //文本样式,NORMAL:常规(默认),BOLD:加粗,ITALIC:斜体,BOLD_ITALIC:斜体加粗
      typeFace: "NORMAL",
      //是否使用抗锯齿功能,默认:true
      antiAlia: true,
      //透明度(0~255),默认:128
      alpha: 128,
      //水印位置,0:左上角(默认),1.右上角,2.左下角,3.右下角
      position: 1,
      //水印左边距,默认:40
      leftMargin: 40,
      //水印右边距,默认:40
      rightMargin: 40,
      //水印上边距,默认:40
      topMargin: 40,
      //水印下边距,默认:40
      bottomMargin: 40
    }]
  }, res => {
    this.writeLog(JSON.stringify(res))
  })
}

参数说明 ​

参数名参数类型是否必填默认值参数描述
typeInteger是无摄像头位置,1.左侧,2.右侧,0.所有
waterMarkerObject否无水印列表
waterMarker.textString否无水印文本内容
waterMarker.colorString否#FFFFFF文本颜色
waterMarker.textSizeInteger否20文本大小
waterMarker.typeFaceString否NORMAL文本样式
NORMAL:常规(默认)
BOLD:加粗
ITALIC:斜体
BOLD_ITALIC:斜体加粗
waterMarker.antiAliaBoolean否true是否使用抗锯齿功能
waterMarker.alphaInteger否128透明度(0~255)
waterMarker.positionInteger否0水印位置,0:左上角(默认),1.右上角,2.左下角,3.右下角
waterMarker.leftMarginInteger否40水印左边距
waterMarker.rightMarginInteger否40水印右边距
waterMarker.topMarginInteger否40水印上边距
waterMarker.bottomMarginInteger否40水印下边距

回调 ​

示例 ​

json
{
    "message": "",
    "code": 0,
    "data": {
        "index":1,
        "path":""
    }
}

回调说明 ​

参数名参数类型参数描述
messageString消息提示
dataObject数据对象
data.indexInteger当前摄像头索引,1.左侧,2.右侧
data.pathString图片文件路径
codeInteger返回类型,0.成功,其他:失败