我是 ionic 新手,所以我对 Ionic 框架不太了解,我正在尝试实现 Cordova-plugin-QR 扫描仪,但它在我的控制台上显示以下错误。
这是我的代码
import { Component, OnInit } from '@angular/core';
import { QRScanner, QRScannerStatus } from '@ionic-native/qr-scanner/ngx';
@Component({
selector: 'app-notification',
templateUrl: './notification.page.html',
styleUrls: ['./notification.page.scss'],
})
export class NotificationPage implements OnInit {
constructor(private qrScanner: QRScanner ) {
}
ngOnInit(){
this.qrScanner.prepare()
.then((status: QRScannerStatus) => {
if (status.authorized) {
// camera permission was granted
// start scanning
let scanSub = this.qrScanner.scan().subscribe((text: string) => {
console.log('Scanned something', text);
this.qrScanner.hide(); // hide camera preview
scanSub.unsubscribe(); // stop scanning
});
} …Run Code Online (Sandbox Code Playgroud)