|
在Android上正常,在iOS不正常。用一个button设定ng-click='scan()',然后在controller中定义scan,
- $scope.scan = function(){
- 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);
- }
- );
- }
复制代码 点开之后扫码界面出现了但是一动不动定格在那里(就像卡死)
我只需要在
- $scope.scan = function(){
- <font color="#ff0000">alert("Xxxx);</font>
- 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);
- }
- );
- }
复制代码 多加一个alert,然后扫码界面就能正常的调出来而且会正常工作。
实在太纠结为什么会有这样的情况,请教。
|
|