Context missing in Capacitor plugin callback


I’m trying to build an Vue Ionic app with a QR Scanner. I’m using the official QRScanner plugin.

Here’s my code:

      QRScanner.scan((err, scanResult) => {
        if (err) {
        } else {
          try {
            this.$router.push({ name: "scan", params: { qrScanResult: scanResult } });
          } catch (e) {

This triggers the following message in XCode’s console:

:zap: [log] - undefined is not an object (evaluating ‘_this2.$router.push’)**

It’s like the context around my callback is lost when coming back from the cordova plugin.
I’d really appreciate some help to solve this issue.