二维码和多选图片插件整理简单实用

二维码扫描插件 适用于3.X+ ios android wp
使用扫码插件
如果是phonegap
cd D:\Code\Android\sencha\MyApp\phonegap  
phonegap plugin add https://github.com/phonegap/phonegap-plugin-barcodescanner向工程中安装barcodescanner插件


如果是Cordova
cd D:\Code\Android\sencha\MyApp\cordova  
cordova plugin add https://github.com/phonegap/phonegap-plugin-barcodescanner向工程中安装barcodescanner插件


js调用:
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);
      }
   );






  phonegap 多图片选择插件
github地址:https://github.com/wymsee/cordova-imagePicker
在线安装地址:
phonegap plugin add https://github.com/wymsee/cordova-imagePicker.git


cordova plugin add https://github.com/wymsee/cordova-imagePicker.git
js调用:


//可选择所有图片
window.imagePicker.getPictures(
    function(results) {
        for (var i = 0; i < results.length; i++) {
            console.log('Image URI: ' + results[i]);
        }
    }, function (error) {
        console.log('Error: ' + error);
    }
);




//最多可选十张图片
window.imagePicker.getPictures(
    function(results) {
        for (var i = 0; i < results.length; i++) {
            console.log('Image URI: ' + results[i]);
        }
    }, function (error) {
        console.log('Error: ' + error);
    }, {
        maximumImagesCount: 10,
        width: 800
    }
);
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值