私はquasar-frameworkを使って作業しています。私はアンドロイドプラットフォーム用のコードバでラップします。Cordova cordova-plugin-qrscanner:不透明カメラビュー
スキャナはうまく動作しますが、盲目的に動作します。
QRScanner.show()が起動すると、完全に不透明なビューが表示されます。私は、すべてのhtml要素を透明にすることを試み、非表示にして、QRScanner.show()呼び出しの前後にそれらの一部を削除しますが、常に不透明なビューが表示されます。誰かがこれを修正する方法を知っていますか?
<script>
export default {
/*
Fuentes:
camera
https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-camera/index.html#takePicture
qrscanner
https://github.com/bitpay/cordova-plugin-qrscanner#prepare
*/
mounted() {
this.prepDevice()
},
data() {
return {
imageURI: '',
authorized: false,
selection: 'standard',
selectOptions: [
{
label: 'Camera-thumbnail',
value: 'camera-thmb'
},
{
label: 'Standard',
value: 'standard'
}
],
enableVisibility: 'hidden',
backColor: 'transparent'
}
},
methods: {
prepDevice() {
QRScanner.prepare(this.onDone)
},
onDone: function (err, status) {
if(err) {
alert("preparing: error code = " + err.code)
}
if(status.authorized) {
this.authorized = true
} else if (status.denied || !status.authorized) {
this.openSettings()
} else {
//No se obtuvo permiso
}
},
goScan: function() {
//--->>> Funciona pero el escaneo es a ciegas (vista en negro) <<<---
this.authorized = false
QRScanner.show()
/*
var html = document.getElementsByTagName("*")
for (var i=0; i<html.length; i++) {
html[i].style.backgroundColor = "transparent"
}
*/
//QRScanner.enableLight()
QRScanner.scan(this.displayContents)
},
displayContents: function (err, text) {
if(err){
alert("scanning: error code = " + err.code)
if(err.name === 'SCAN_CANCELED') {
alert("The scan was canceled before a QR code was found.")
}
} else {
alert(text)
}
//QRScanner.hide()
//QRScanner.disableLight()
QRScanner.destroy() // hide, cancelScan...
this.authorized = true
},
cancelScan() {
QRScanner.cancelScan()
this.authorized = true
},
openSettings() {
if(status.canOpenSettings){
if(confirm("Would you like to enable QR code scanning? You can allow camera access in your settings.")){
QRScanner.openSettings();
}
}
}
}
}
そして、私はgoScan関数を呼び出すHTML:
<button v-if="authorized" class="secondary push" @click="goScan()">Go Scan</button>
はリソース:https://github.com/bitpay/cordova-plugin-qrscanner
私は、スキャンがフル不透明カメラビューで盲目的に正常に動作しますが、言ったように。
ありがとうございました。
私は 'cordova-plugin-camera'との関係を理解していません。 'cordova-plugin-qrscanner'は決してそれに依存しません、そして、私は2人がどのように相互作用するか分かりません。 'cordova-plugin-camera 'はスキャナの可視性を妨害することができますか? –
ちなみに、プラグイン名はあなたのタイトルに間違って綴られているため、あなたの質問を見つけるのが難しくなる可能性があります。 –
私は自己を間違って表現しています。カメラプラグインは何もしません プラグイン名を編集しました。@ JasonDreyzehnerにお返事いただきありがとうございます – ricopo