本文整理汇总了TypeScript中ionic-native.BarcodeScanner.scan方法的典型用法代码示例。如果您正苦于以下问题:TypeScript BarcodeScanner.scan方法的具体用法?TypeScript BarcodeScanner.scan怎么用?TypeScript BarcodeScanner.scan使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ionic-native.BarcodeScanner
的用法示例。
在下文中一共展示了BarcodeScanner.scan方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: scan
scan(event) {
BarcodeScanner.scan().then((data) => {
this.barcodeData = data;
}, (error) => {
console.log("Error: ", error);
})
}
示例2: scanCode
scanCode() {
BarcodeScanner.scan().then((barcodeData) => {
if (barcodeData.cancelled !== 1) {
this.dataStore.checkHistory(barcodeData.text).then((data) => {
var isDuplicate = (data.res.rows.length > 0);
this.local.get(OPTIONS_KEY_NAME).then((res) => {
let options = JSON.parse(res) || {};
if (options.ignoreDuplicateScans && isDuplicate) {
let alert = this.alerts.create({
title: 'Duplicate Entry',
subTitle: 'This scan has been ignored.',
buttons: ['Dismiss']
});
alert.present();
}
else {
this.fetchItem(barcodeData);
}
});
});
}
}, (err) => {
let alert = this.alerts.create({
title: 'Scan Error',
subTitle: err,
buttons: ['Dismiss']
});
alert.present();
});
}
示例3: function
this.platform.ready().then(() => {
BarcodeScanner.scan().then((barcodeData) => {
//this.test = JSON.stringify(barcodeData);
}, function (error) {
//this.test = 'error : ' + error;
})
})
示例4: scan
private scan() {
BarcodeScanner.scan().then((barcodeData) => {
this.isbn = barcodeData.text;
this.searchBook();
}, (err) => {
console.error('une erreur est interceptée', err)
});
}
示例5: loginForQR
//通过扫描二维码登陆
loginForQR(){
BarcodeScanner.scan().then((barcodeData) => {
this.accesstoken=barcodeData.text;
this.login();
}, (err) => {
alert("调用本地相机失败!");
});
}
示例6: scan
scan() {
BarcodeScanner.scan().then(barcodeData => {
this.barcodeData = barcodeData;
}, (err) => {
console.log(err);
});
}
示例7: loginForQR
//通过扫描二维码登陆
loginForQR(){
// 问题是,扫描后,accesstoken如何写入input
BarcodeScanner.scan().then((barcodeData) => {
this.accesstoken=barcodeData.text;
this.login();
}, (err) => {
// An error occurred
});
}
示例8: scan
scan(){
BarcodeScanner.scan().then(
barcodeData=>{
this.data = barcodeData;
},
err=>{
this.data = 'There was an error:'+err;
}
);
}
示例9: startScan
startScan() {
return BarcodeScanner.scan().then(
(result) => {
console.log(result);
},
(error) => {
console.log(error);
}
)
}
示例10:
this.platform.ready().then(() => {
BarcodeScanner.scan().then((result) => {
if (!result.cancelled) {
this.barcodeText = result.text;
this.barcodeFormat = result.format;
this.scanningDone({'text':result.text,'format':result.format});
}
}, (error) => {
console.log('error when scanning product barcode');
});
});