vuejs.org | Support Level
= Strong
<script src="https://unpkg.com/html5-qrcode"></script>
Vue.component('qrcode-scanner', {
props: {
qrbox: {
type: Number,
default: 250
},
fps: {
type: Number,
default: 10
},
},
template: `<div id="qr-code-full-region"></div>`,
mounted () {
const config = {
fps: this.fps,
qrbox: this.qrbox,
};
const html5QrcodeScanner = new Html5QrcodeScanner('qr-code-full-region', config);
html5QrcodeScanner.render(this.onScanSuccess);
},
methods: {
onScanSuccess (decodedText, decodedResult) {
this.$emit('result', decodedText, decodedResult);
}
}
});
<template>
<qrcode-scanner
:qrbox="250"
:fps="10"
style="width: 500px;"
@result="onScan"
/>
</template>
<script>
export default {
methods: {
onScan (decodedText, decodedResult) {
// handle the message here :)
}
}
}
</script>
Name | Profile |
---|---|
Jofferson Ramirez Tiquez | @jofftiquez |