更新记录
1.0.8(2025-05-18)
修复在uniapp项目中识别不到的bug
1.0.7(2025-05-18)
增加log
1.0.6(2024-10-28)
解析代码优化
查看更多
平台兼容性
uni-app
Vue2 |
Vue3 |
Chrome |
Safari |
app-vue |
app-nvue |
Android |
iOS |
鸿蒙 |
√ |
√ |
- |
- |
- |
- |
5.0 |
× |
- |
微信小程序 |
支付宝小程序 |
抖音小程序 |
百度小程序 |
快手小程序 |
京东小程序 |
鸿蒙元服务 |
QQ小程序 |
飞书小程序 |
快应用-华为 |
快应用-联盟 |
× |
× |
× |
× |
× |
× |
- |
× |
× |
× |
× |
uni-app x
Chrome |
Safari |
Android |
iOS |
鸿蒙 |
微信小程序 |
- |
- |
5.0 |
× |
- |
× |
xwq-mlkit-card-text
开发文档
初始化参数说明
属性 |
类型 |
默认值 |
描述 |
type |
number |
1 |
识别正反面类型,1正面 2反面 |
firstLlineText |
string |
-- |
识别框底部文字第一行自定义内容 |
secondLineText |
string |
-- |
识别框底部文字第二行自定义内容 |
callback回调函数参数对象说明
属性 |
类型 |
描述 |
address |
string |
地址 |
cs |
string |
出生年月 |
id |
string |
身份证号 |
name |
string |
姓名 |
national |
string |
民族 |
sex |
string |
性别 |
validTime |
string |
有效期(反面识别时返回) |
插件使用例子
<template>
<view>
<button @click="openCard">身份证识别</button>
</view>
</template>
<script>
import {openCardCamera,ScanParamsType,callbackValType} from '../../uni_modules/xwq-mlkit-card-text';
export default {
data() {},
methods: {
openCard(){
openCardCamera({
type:1, //1代表正面 2代表反面
firstLlineText:'第一行自定义内容',
secondLineText:'第二行自定义内容',
success:(val:callbackValType)=>{
console.log('识别结果===',val)
}
} as ScanParamsType);
}
}
}
</script>
注意了:uniapp项目使用该插件,需要将插件uni_modules\xwq-mlkit-card-text\utssdk\app-android\config目录下的这几个文件替换
"androidx.camera:camera-core:1.2.0",
"androidx.camera:camera-camera2:1.2.0",
"androidx.camera:camera-lifecycle:1.2.0",
"androidx.camera:camera-view:1.2.0",
<template>
<view>
<button @click="openCard">身份证识别</button>
</view>
</template>
<script>
import {openCardCamera} from '../../uni_modules/xwq-mlkit-card-text';
export default {
data() {},
methods: {
openCard(){
openCardCamera({
type:1, //1代表正面 2代表反面
firstLlineText:'第一行自定义内容',
secondLineText:'第二行自定义内容',
success:(val:callbackValType)=>{
console.log('识别结果===',val)
}
});
}
}
}
</script>