我在Ionic App中显示由phonegap的条形码扫描仪插件生成的QRCode时出现问题。我有另一个具有相同代码的应用程序,它可以正常工作,我会复制我的代码,以防万一有人发现它有用,但可能不是问题。我发现的是,它第一次将其作为MIME文本/纯文本加载,而下次我尝试将其加载为错误代码404。 编辑:我知道路径上有一些额外的引号[''],在我几个小时前拍照并修复并没有解决问题时,请忽略它们 代码:
encodeText(){ //Function that encodes text. Codigo is a string
this.barcodeScanner.encode(this.barcodeScanner.Encode.TEXT_TYPE,this.codigo).then((encodedData) => {
console.log(encodedData);
this.srcQR= encodedData.file;
}, (err) => {
console.log("Error occured : " + err);
});
}][1]
<ion-content padding> <-- HTML Code !->
<ion-item>
<img src={{srcQR}} class="center" *ngIf="srcQR" />
</ion-item>
<h3>{{codigo}} y {{srcQR}}</h3>
</ion-content>
From my package.json
"dependencies": {
"@angular/animations": "5.2.11",
"@angular/common": "5.2.11",
"@angular/compiler": "5.2.11",
"@angular/compiler-cli": "5.2.11",
"@angular/core": "5.2.11",
"@angular/forms": "5.2.11",
"@angular/http": "5.2.11",
"@angular/platform-browser": "5.2.11",
"@angular/platform-browser-dynamic": "5.2.11",
"@ionic-native/barcode-scanner": "^4.17.0",
"@ionic-native/camera": "^4.17.0",
"@ionic-native/core": "~4.15.0",
"@ionic-native/fcm": "^4.16.0",
"@ionic-native/file": "^4.17.0",
"@ionic-native/file-path": "^4.17.0",
"@ionic-native/splash-screen": "~4.15.0",
"@ionic-native/status-bar": "~4.15.0",
"@ionic-native/transfer": "^3.14.0",
"@ionic/storage": "2.2.0",
"chart.js": "^2.7.3",
"cordova-android": "^7.1.2",
"cordova-ios": "^4.5.5",
"cordova-plugin-camera": "^4.0.3",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-fcm": "~2.1.2",
"cordova-plugin-fcm-with-dependecy-updated": "^2.2.6",
"cordova-plugin-file": "^6.0.1",
"cordova-plugin-file-transfer": "^1.7.1",
"cordova-plugin-ionic-keyboard": "^2.1.3",
"cordova-plugin-ionic-webview": "^2.2.0",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"ionic-angular": "3.9.2",
"ionicons": "3.0.0",
"ng2-charts": "^1.6.0",
"npm-check": "^5.9.0",
"phonegap-plugin-barcodescanner": "^8.0.0",
"rxjs": "5.5.11",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.26"
First time I try to show de QRcode
Second time I try to show the QR
Proof the QR actually exists and QR is being created succesfully
让我知道我还能提供什么
答案 0 :(得分:0)
因此,我修复了将“ cordova-plugin-ionic-webview”:“ ^ 2.2.0”降级为“ cordova-plugin-ionic-webview”:“ 1.1.19”的问题。应该有一种方法可以使条形码扫描仪不降级,但是我找不到它。