二维码扫描插件 适用于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
}
);
使用扫码插件
如果是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
}
);