From 3c798a56069c4f7266f7fb856029ed1b4779e965 Mon Sep 17 00:00:00 2001 From: memorydream <34763046+memorydream@users.noreply.github.com> Date: Wed, 27 Apr 2022 18:38:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BD=BF=E7=94=A8svg=E8=BE=93=E5=87=BA?= =?UTF-8?q?=E7=99=BB=E9=99=86=E4=BA=8C=E7=BB=B4=E7=A0=81=20(#1568)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/loginAccount.vue | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/views/loginAccount.vue b/src/views/loginAccount.vue index 3e00794..ff4d859 100644 --- a/src/views/loginAccount.vue +++ b/src/views/loginAccount.vue @@ -68,8 +68,8 @@
-
- +
+
{{ qrCodeInformation }} @@ -135,7 +135,7 @@ export default { smsCode: '', inputFocus: '', qrCodeKey: '', - qrCodeImage: '', + qrCodeSvg: '', qrCodeCheckInterval: null, qrCodeInformation: '打开网易云音乐APP扫码登录', }; @@ -233,19 +233,22 @@ export default { return loginQrCodeKey().then(result => { if (result.code === 200) { this.qrCodeKey = result.data.unikey; - QRCode.toDataURL( + QRCode.toString( `https://music.163.com/login?codekey=${this.qrCodeKey}`, { - width: 384, + width: 192, margin: 0, color: { dark: '#335eea', light: '#00000000', }, + type: 'svg', } ) - .then(url => { - this.qrCodeImage = url; + .then(svg => { + this.qrCodeSvg = `data:image/svg+xml;utf8,${encodeURIComponent( + svg + )}`; }) .catch(err => { console.error(err);