【发布时间】:2018-11-17 20:58:22
【问题描述】:
我在 Angular 项目中遇到了 cordova-plugin-qrscanner 的问题。在我的组件中,我扫描 QR 码,如果扫描完成,我想导航到另一个组件。 不幸的是,它不能正常工作。这是我的代码的一部分
scan() {
// QRScanner.prepare();
const that = this;
QRScanner.show();
window.document.querySelector('body').classList.remove('transparentBody');
QRScanner.scan(displayContents);
function displayContents(err, text) {
if(err){
console.log('error', err);
// an error occurred, or the scan was canceled (error code `6`)
} else {
// The scan completed, display the contents of the QR code:
alert(text);
this._router.navigate(['/main/depositor']); // here dosen't work
if (text) {`enter code here`
QRScanner.destroy((status) => {
console.log('destroy scanner', status);
window.document.querySelector('body').classList.add('transparentBody');
this._router.navigate(['/main/depositor']); // here too dosen't work
});
}
}
}
}
有人有类似的问题吗?在我的手机应用程序上导航后退出或什么都不做。我不知道出了什么问题
【问题讨论】:
标签: android angular cordova cordova-plugins