Phonegap 构建 cli-5.2.0 - 插件条形码扫描器未触发
Phonegap build cli-5.2.0 - plugin barcodescanner not firing
我正在使用 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>
警报出现,但扫描仪未打开。
我做错了什么?
我成功了。
我不得不补充:
<script src="phonegap.js"></script>
<script src="barcodescanner.js"></script>
进入index.html页面。这解决了我的问题。
我正在使用 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>
警报出现,但扫描仪未打开。
我做错了什么?
我成功了。
我不得不补充:
<script src="phonegap.js"></script>
<script src="barcodescanner.js"></script>
进入index.html页面。这解决了我的问题。