本文整理匯總了TypeScript中ionic-native.BarcodeScanner類的典型用法代碼示例。如果您正苦於以下問題:TypeScript BarcodeScanner類的具體用法?TypeScript BarcodeScanner怎麽用?TypeScript BarcodeScanner使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了BarcodeScanner類的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');
});
});