vue 显示 睡眠功能

不需要这个加载组件,你们把这些全部去掉console.log()打印就可以了。

<style>
    /*加载*/
    .loader {
        position: absolute;
        left: 45%;
        top: 40%;
        z-index: 12;
    }
</style>
<template>
    <div>
        <!--加载-->
        <mu-circular-progress :size="40" color="#1da7eb" v-show="isLoader" class="loader"/>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                // 加载
                isLoader: true
            }
        },
        created() {
            this.test()
        },
        methods: {
            sleep(d) {
                return new Promise((resolve) => setTimeout(resolve, d))
            },
            async test() {
                this.$toast.show('正在自动登录')
                // console.log('1111')
                await this.sleep(1800)
                this.$toast.show('登录成功')
                // console.log('2222')
                await this.sleep(1800)
                this.isLoader = false
            }
        }
    }
</script>

发布了185 篇原创文章 · 获赞 121 · 访问量 39万+

猜你喜欢

转载自blog.csdn.net/echo_Ae/article/details/80690432