Fix QR code

This commit is contained in:
N-Pex 2021-04-02 09:40:23 +02:00
parent b246a134e2
commit 73f7a0d4d8

View file

@ -26,7 +26,14 @@
<div class="h1">{{ roomName }}</div> <div class="h1">{{ roomName }}</div>
<div class="h3">{{ roomTopic }}</div> <div class="h3">{{ roomTopic }}</div>
<div class="small">Created by {{ creator }}</div> <div class="small">Created by {{ creator }}</div>
<canvas class="qr" id="room-qr"></canvas> <v-expand-transition>
<canvas
v-if="publicRoomLink"
ref="roomQr"
class="qr"
id="room-qr"
></canvas>
</v-expand-transition>
</div> </div>
</v-card> </v-card>
@ -113,7 +120,11 @@
Your are logged in as <b>{{ displayName }}</b Your are logged in as <b>{{ displayName }}</b
>. >.
</div> </div>
<v-btn depressed block class="outlined-button" @click.stop="viewProfile" <v-btn
depressed
block
class="outlined-button"
@click.stop="viewProfile"
>View</v-btn >View</v-btn
> >
</div> </div>
@ -263,21 +274,23 @@ export default {
}, },
updateQRCode() { updateQRCode() {
var fullUrl = this.roomLink; var fullUrl = this.publicRoomLink;
var canvas = document.getElementById("room-qr"); var canvas = this.$refs.roomQr;
QRCode.toCanvas( if (fullUrl && canvas) {
canvas, QRCode.toCanvas(
fullUrl, canvas,
{ fullUrl,
type: "image/png", {
margin: 1, type: "image/png",
width: canvas.clientWidth, margin: 1,
}, width: canvas.clientWidth,
function (error) { },
if (error) console.error(error); function (error) {
else console.log("success!"); if (error) console.error(error);
} else console.log("success!");
); }
);
}
}, },
memberAvatar(member) { memberAvatar(member) {
@ -298,7 +311,7 @@ export default {
}, },
copyRoomLink() { copyRoomLink() {
this.$copyText(this.roomLink).then( this.$copyText(this.publicRoomLink).then(
function (e) { function (e) {
console.log(e); console.log(e);
}, },
@ -359,6 +372,7 @@ export default {
}) })
.finally(() => { .finally(() => {
this.updatingJoinRule = false; this.updatingJoinRule = false;
this.updateQRCode();
}); });
}, },
}, },