0
我使用phonegap生成版本cli-5.2.0和barcodescanner插件。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>
警報即將出現,但掃描儀未打開。
我在做什麼錯在這裏?