【发布时间】: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