插件地址
https://github.com/gizwits/cordova-gizwits-scan-qrcode
插件安装方式
cordova plugin add https://github.com/gizwits/cordova-gizwits-scan-qrcode
该插件需要安装依赖(官方文档没有说明)
cordova plugin add cordova-android-support-gradle-release
插件调用方式
cordova.plugins.gizscanqrcode.scan( {//全部参数 "baseColor": "#4e8dec",//(边框、按钮、导航栏等背景颜色,优先级最低,单独设置可覆盖) //bar "title": "我是标题",//(标题文字) "barColor": "4e8dec",//(导航栏颜色) "statusBarColor": "white",//(状态栏字体颜色 white为白,不填为默认) //describe string "describe": "我是提示语",//(提示用户文字,支持 \n 换行,多行文字需注意小屏幕设备适配问题) "describeFontSize": "15",//(字体大小) "describeLinespacing": "8",//(行间距) "describeColor": "ffffff",//(文字颜色) //scan border "borderColor": "4e8dec",//(扫描框颜色) "borderScale": "0.6",//(边框大小,0.1 ~ 1) //choose photo button "choosePhotoEnable": "true",//(支持相册选取,默认false) "choosePhotoBtnTitle": "相册",//(选取按钮文字) "choosePhotoBtnColor": "4e8dec",//(选取按钮颜色) //flashlight "flashlightEnable": "true" //(支持手电筒,默认false) },function (result) { console.log(result);//二维码数据 alert(JSON.stringify(result)); },function (error) { console.log(error);//原因 alert(JSON.stringify(error)) } );
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。