Cordova Barcode Scanner does not work



  • Hello ,

    So I was able to create a project successfully and deployed to my phone . but I am using a cordova plugin .

    So when I try to access this plugin I get following error

     vendor.js:11 Uncaught TypeError: e.$parent.close is not a function
        at click (vendor.js:11)
        at HTMLButtonElement.t (vendor.js:6)
    
    

    MY Code looks like this

    methods:{
        scanQR () {
          this.cordova.plugins.barcodeScanner.scan(
            result => {
              if (result.cancelled) {
                Toast.create('QR code scanning aborted...')
                return
              }
            },
            error => {
              Toast.create('error');
              Dialog.create({
                message: 'Failed to scan the QR code: ' + error
              })
            }
          )
        }
    }
    


  • What does the content of your <template> tag look like?



  • it seems like this is the example https://github.com/vikramIde/stock_scan1 it might help somebody else reaching here.
    pst: it’s using a pretty old version of quasar doh



  • @vikram
    I used it this way in a quasar version 0.15 project and it worked fine.
    cordova without the “this”

       scan () {
          cordova.plugins.barcodeScanner.scan(function (result) {
            alert(result.text)
           }, function (error) { alert(error) })
        }
    

Log in to reply