Flutter教程

ZBar

Contents

The ZBar Scanner Plugin allows you to scan 2d barcodes.

Requires Cordova plugin: cordova-plugin-cszbar. For more info, please see the zBar plugin docs.

https://github.com/tjwoon/csZBar

联系我们?

If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic's experts offer official maintenance, support, and integration help.

Contact Us Today!

Ionic 扫码ZBar插件的安装(Installation)

ionic cordova plugin add cordova-plugin-cszbar npm install @ionic-native/zbar
Ionic EE comes with fully supported and maintained plugins from the Ionic Team. Learn More or Contact Us
ionic enterprise register --key=YOURPRODUCTKEY npm install @ionic-enterprise/zbar

Ionic 扫码ZBar插件支持的平台(Supported Platforms)

  • Android
  • iOS

Ionic 扫码ZBar插件的用法(Usage)

import { ZBar, ZBarOptions } from '@ionic-native/zbar/ngx';

constructor(private zbar: ZBar) { }

...

let options: ZBarOptions = {
      flash: 'off',
      drawSight: false
    }

this.zbar.scan(options)
   .then(result => {
      console.log(result); // Scanned code
   })
   .catch(error => {
      console.log(error); // Error message
   });