【问题标题】:Phonegap build cli-5.2.0 - plugin barcodescanner not firingPhonegap build cli-5.2.0 - 插件barcodescanner未触发
【发布时间】:2015-10-17 16:01:43
【问题描述】:

我正在使用 phonegap 构建版本 cli-5.2.0 和barcodescanner 插件。

我已将插件添加到 config.xml:

然后在我的 index.html 页面中我添加了:

<script>
function clickScan() {

alert('tester');

cordova.plugins.barcodeScanner.scan(
      function (result) {
          alert("We got a barcode\n" +
                "Result: " + result.text + "\n" +
                "Format: " + result.format + "\n" +
                "Cancelled: " + result.cancelled);
      }, 
      function (error) {
          alert("Scanning failed: " + error);
      }
   );


};
</script>

然后是一个按钮:

<button onclick="clickScan();">Scan</button>

警报正在发出,但扫描仪未打开。

我在这里做错了什么?

【问题讨论】:

    标签: cordova phonegap-plugins phonegap-build


    【解决方案1】:

    我搞定了。

    我必须补充:

    <script src="phonegap.js"></script>
    <script src="barcodescanner.js"></script>
    

    到 index.html 页面。就我而言,这解决了它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-23
      • 1970-01-01
      • 2014-02-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多