mirror of
https://github.com/TeamPiped/Piped.git
synced 2025-01-08 10:30:28 +05:30
31 lines
585 B
Vue
31 lines
585 B
Vue
<template>
|
|
<canvas ref="qrCodeCanvas" class="mx-auto my-2" />
|
|
</template>
|
|
<script>
|
|
import QRCode from "qrcode";
|
|
|
|
export default {
|
|
props: {
|
|
text: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
},
|
|
watch: {
|
|
text() {
|
|
this.generateQrCode();
|
|
},
|
|
},
|
|
mounted() {
|
|
this.generateQrCode();
|
|
},
|
|
methods: {
|
|
generateQrCode() {
|
|
QRCode.toCanvas(this.$refs.qrCodeCanvas, this.text, error => {
|
|
if (error) console.error(error);
|
|
});
|
|
},
|
|
},
|
|
};
|
|
</script>
|