cordova插件文档扫描仪中的扫描对象定义不足
我正在尝试在我的ionic应用程序中使用cordova插件文档扫描仪。但在设备就绪功能中,我无法访问全局扫描对象。这是密码cordova插件文档扫描仪中的扫描对象定义不足,cordova,ionic3,cordova-plugins,Cordova,Ionic3,Cordova Plugins,我正在尝试在我的ionic应用程序中使用cordova插件文档扫描仪。但在设备就绪功能中,我无法访问全局扫描对象。这是密码 this.platform.ready().then((readySource) => { console.log('Platform ready from', readySource); // Platform now ready, execute any required native code console.log(scan); });
this.platform.ready().then((readySource) => {
console.log('Platform ready from', readySource);
// Platform now ready, execute any required native code
console.log(scan);
});
这是个例外
Error: Uncaught (in promise): ReferenceError: 'scan' is not defined
ReferenceError: 'scan' is not defined
at Anonymous function (http://localhost:8100/build/main.js:839:13)
at t.prototype.invoke (http://localhost:8100/build/polyfills.js:3:14879)
at onInvoke (http://localhost:8100/build/vendor.js:5134:17)
at t.prototype.invoke (http://localhost:8100/build/polyfills.js:3:14879)
at r.prototype.run (http://localhost:8100/build/polyfills.js:3:10117)
at Anonymous function (http://localhost:8100/build/polyfills.js:3:20233)
at t.prototype.invokeTask
谁能帮我找出哪里出了问题吗?很高兴在这里见到你:)
只是为了未来的用户解决了github问题
以下是步骤:-
1) 在终端中创建空白的Ionic项目
ionic启动我的项目空白
2) 向项目添加插件
爱奥尼亚cordova插件添加cordova插件文档扫描仪
3) 现在导航到E:\myproject\src\app\app.component.ts
-添加声明var扫描代码>以上@组件({..
-然后进入platform.ready()。然后(()=>{}
函数添加
以下函数如自述文件所示
scan.scanDoc(1, onSuccess, onFail);
function onSuccess(imageURI) {
//var image = document.getElementById('myImage');
//image.src = imageURI;
}
function onFail(message) {
alert('Failed because: ' + message);
}
4) 然后在终端爱奥尼亚cordova运行android
5) 如果遇到问题,也不要忘记阅读文档和其他解决方案
祝大家度过愉快的一天:)您正在设备中运行此应用程序?如果是这样的话,您是在使用livereload还是其他什么?我正在使用ionic devapp在手机上运行它。是的,我正在使用live reload。我发现cordova插件与livereload和devapp不兼容…您应该尝试直接在设备中运行此应用程序。但当我尝试这样做时从这个插件导入一些东西。然后我得到“找不到模块”错误。这可能是一个问题吗?你在运行时得到了吗?很好的解决方案,建议的解决方案对我很有效