# yuOcr 依赖原生的ocr输入框
依赖原生提供的ocr能力,封装的ocr输入框,目前支持身份证识别、银行卡识别,可在此基础上扩展
# 效果预览
<template>
<div style="height: 100%;">
<yu-ocr label="身份证号码" :idType="'2'" required placeholder="请录入证件号码" v-model="ocrResult1" name="cert" :disabled="false" @change="changeFn1"></yu-ocr>
<yu-ocr label="银行卡账号" :idType="'4'" required placeholder="请录入银行卡号码" v-model="ocrResult2" name="cert" :disabled="false" @change="changeFn2"></yu-ocr>
</div>
</template>
<script>
import yuOcr from '@/components/yu-ocr/index.vue'
export default {
components: {
yuOcr
},
data() {
return {
ocrResult1: '',
ocrResult2: ''
};
},
methods: {
changeFn1(val) {
console.log(' ======== >>>>', this.ocrResult1)
},
changeFn2(val) {
console.log(' ======== >>>>', this.ocrResult2)
}
}
};
</script>
# Attributes
参数 | 说明 | 类型 | 可选值 | 默认值 |
---|---|---|---|---|
v-model | 双向绑定值,识别结果 | string | - | - |
label | 标题 | String | - | - |
label-width | 标题宽度 | string(px) | - | - |
disabled | 是否不可编辑,暗色 | Bool | true/false | - |
details | 是否是详情反显,不可点击,正常色 | Bool | true/false | - |
placeholder | 选项框placeholder | string | - | - |
required | 选项框是否必输 | Bool | true/false | - |
rules | 选项框校验规则 | Array | - | - |
idType | 识别证件类型 | string(目前支持2和4,主要是回调数据差异,其他类型可自行扩展) | '0': '通用文字识别' '1': '身份证识别' '2': '身份证正面识别' '3': '身份证背面识别' '4': '银行卡识别' '5': '网络图片识别' '6': '驾驶证证识别' '7': '行驶证识别' '8': '车牌识别' '9': '营业执照识别' '10': '票据识别' | - |
# Events
方法名 | 说明 | 参数 |
---|---|---|
change | 识别结果输出 |