Barcode Scanner

Contents

The Barcode Scanner Plugin opens a camera view and automatically scans a barcode, returning the data back to you.

https://github.com/phonegap/phonegap-plugin-barcodescanner

Ionic 二维码扫描Barcode Scanner插件的安装(Installation)

ionic cordova plugin add phonegap-plugin-barcodescanner npm install @ionic-native/barcode-scanner

Ionic 二维码扫描Barcode Scanner插件支持的平台(Supported Platforms)

  • Android
  • BlackBerry 10
  • Browser
  • iOS
  • Windows

Ionic 二维码扫描Barcode Scanner插件的用法(Usage)

import { BarcodeScanner } from '@ionic-native/barcode-scanner';

constructor(private barcodeScanner: BarcodeScanner) { }

...


this.barcodeScanner.scan().then(barcodeData => {
 console.log('Barcode data', barcodeData);
}).catch(err => {
    console.log('Error', err);
});