wujingjing
2024-09-29 b9f5b855a3b8890d7dbbab6985bf4f78315cfe49
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<template>
    <div class="login-scan-container">
        <div ref="qrcodeRef"></div>
        <div class="font12 mt20 login-msg">
            <i class="myiconfont icon-saoyisao mr5"></i>
            <span>{{ $t('message.scan.text') }}</span>
        </div>
    </div>
</template>
 
<script setup lang="ts" name="loginScan">
import QRCode from 'qrcodejs2-fixes';
import { nextTick, onMounted, ref } from 'vue';
 
// 定义变量内容
const qrcodeRef = ref<HTMLElement | null>(null);
 
// 初始化生成二维码
const initQrcode = () => {
    nextTick(() => {
        (<HTMLElement>qrcodeRef.value).innerHTML = '';
        new QRCode(qrcodeRef.value, {
            text: `https://qm.qq.com/cgi-bin/qm/qr?k=RdUY97Vx0T0vZ_1OOu-X1yFNkWgDwbjC&jump_from=webapi`,
            width: 260,
            height: 260,
            colorDark: '#000000',
            colorLight: '#ffffff',
        });
    });
};
// 页面加载时
onMounted(() => {
    initQrcode();
});
</script>
 
<style scoped lang="scss">
.login-scan-animation {
    opacity: 0;
    animation-name: error-num;
    animation-duration: 0.5s;
    animation-fill-mode: forwards;
}
.login-scan-container {
    padding: 0 20px 20px;
    display: flex;
    flex-direction: column;
    text-align: center;
    @extend .login-scan-animation;
    animation-delay: 0.1s;
    :deep(img) {
        margin: auto;
    }
    .login-msg {
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--el-text-color-placeholder);
        @extend .login-scan-animation;
        animation-delay: 0.2s;
    }
}
</style>