当前位置 : 主页 > 网络编程 > JavaScript >

vue进入页面加载数据缓慢实现loading提示过程

来源:互联网 收集:自由互联 发布时间:2023-02-08
目录 进入页面加载数据缓慢实现loading提示 参数列表说明如下(详细可以观看elementUI官网) vue中加载loading问题 1.loading.vue组件内容如下 2.app.vue中设置 3.在main.js中设置 4.在.vue组件中使用
目录
  • 进入页面加载数据缓慢实现loading提示
    • 参数列表说明如下(详细可以观看elementUI官网)
  • vue中加载loading问题
    • 1.loading.vue组件内容如下
    • 2.app.vue中设置
    • 3.在main.js中设置  
    • 4.在.vue组件中使用

进入页面加载数据缓慢实现loading提示

比如进入一个页面数据加载缓慢的页面后,等待后端返回数据显示在页面时给个loading的样式

像下面这样:

代码实现如下:

 getStudent() {
      // 开始加载
      let loading = this.$loading({
        lock: true,//lock的修改符--默认是false
        text: "拼命加载中,请稍候...",//显示在加载图标下方的加载文案
        background: "rgba(0,0,0,0.8)",//遮罩层颜色
        spinner: "el-icon-loading",//自定义加载图标类名
      });
      getStudent().then(res => {
        if (res.code === 200) {
          this.user = res.data;
          // 获取数据显示成功后,关闭loading
          loading.close();
        } else {
          this.$message.error("错误!");
        }
      });
    }

参数列表说明如下(详细可以观看elementUI官网)

参数说明类型默认值targetLoading 需要覆盖的 DOM 节点。可传入一个 DOM 对象或字符串;若传入字符串,则会将其作为参数传入 document.querySelector以获取到对应 DOM 节点object/stringdocument.bodybody同 v-loading 指令中的 body 修饰符booleanfalsefullscreen同 v-loading 指令中的 fullscreen 修饰符booleantruelock同 v-loading 指令中的 lock 修饰符booleanfalsetext显示在加载图标下方的加载文案string—spinner自定义加载图标类名string—background自定义加载图标类名string—customClass自定义加载图标类名string—

vue中加载loading问题

首先在components文件夹中新建一个loading.vue组件:

1.loading.vue组件内容如下

<template>
  <div class="markbox" v-show="loading" style="background-color: rgba(0, 0, 0, 0.5);">
    <div class="sun-loading"></div>
  </div>
</template>
<script>
export default {
    name: 'loading',
    data() {
        return {
            loading: false
        }
    },
    created() {
        var that = this;
        this.bus.$on('loading', function(data) {
            that.loading = !!data;
        })
    }
}
</script>

css代码:

/*loading开始*/
.sun-loading {
	width: 45px;
	height: 45px;
	display: block;
	animation: sunLoading 1s steps(12, end) infinite;
	background: transparent 	url('data:image/gif;base64,R0lGODlhQABAAKUAAAQCBFxeXDQyNIyKjBwaHHR2dExKTKSipAwODGxqbDw+PJSWlCQmJISChFRWVKyurAwKDGRmZDw6PJSSlCQiJHx+fFRSVKyqrBQWFHRydERGRJyenCwuLAQGBGRiZDQ2NIyOjBweHHx6fExOTKSmpBQSFGxubERCRJyanCwqLISGhFxaXLSytAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJCQAtACwAAAAAQABAAAAG/sCWcEgsGo9CjsWSQjqf0KiTYRhVKdKsdnuqVgXbsPjYtY4+43SR4olYEM6T2SBxIiQfBUaNRET+EQ5xXmdOHwKIEh18RikRCY8RTWSEdUcUAoeHWIxEGH9tER4ARwojVgZoRh0SiIgfcJ1EI5AJbQpkZiOWRSmaiByyRSWif7axRHJevEN3AhyayMJCJ4+hBkbKVsxCzx+aDNNFHaGQESFFZVXcBIeuH4viRBygj4LJc8wAv4fo8kUrrP0JNkQbHSIMXEFTpQZCij1OQpQTFa+FQV6sNH2DiAQDhYpGGIioUMFBCScGQNnCJUSChg8uwSRxB43gkRIUCBCgcPJI/oEGFYCKOEHKiB9bgIoigaAgUyYJEI50oBCCAAarNouQBAq0QoGsQySAEqDUCQAGrQSEMxKCgc6rV9caSbA1qN0IBIoA8GAAZJQOmcq2wODW6ludcofRJWk3qAgLUYdEFjO5BYLCVw1bZSDNiICRDUR0JSlCgWA1AEJQgKuZsD8oHQyMtMu1gonKaS7r1GyVAgO/UEqsqM31Xie3ma+27ayFwmKSBXA3RI6YoxoJoLkxesvgdScIIwqc5tOBw+9/wDuN/8e+vfsoAgJ4mE+//nxs7ENgK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xoMKfFSCB5p2ZDjBpEQ5QeQKjLQCgQZgPlGiEAhtYSAISKmA6wQjIIXABgigYiSSCJHTaQQCQ0gcCEilM8KQH5rJlgOADbJIlwk4igNhCBPU9EIETGBQgHwlkAiUAaUYwICoLG0gkwqgmWESCqA+wakQIHMiWxQD2UTNEBaImPIQB9uU6nQIIsqBCERXUp7EQAIBQ76/MNTtqvy3ER9/JQnBg3wKxnrECgfPRLETJMxuBcX3KsoPBtaPedHDQRWAwMAly+iKiqA4cISLTRQQwsM+cEDAwzkcM3fMRHbhMYNSLSFAxElePfQTI9enIh7UVjsy2yU6AUCEJOW/BAQoPVCAb0G4fgYEKDywAc49CyFw442C0zcK9kIcB93wsV67FCJlK+EwQADtUOWFJRjZRTUdLT3ZvQmJwaW9RWTRZNHZYV2lSM0dVdlpsZUxtWU5rbkt4aVAvY1QwekJNNTZaY2tKWDZOaURM');
	background-size: 100%;
    margin:auto;
    position:absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right:0;
}
/*loading结束*/	

2.app.vue中设置

<template>
  <div id="app">
    <router-view/>
    <loading></loading>   
  </div>
</template>
<script>
    import loading from '@/components/common/loading'
    export default {
      name: 'App',
      components:{loading}
    }
</script>

3.在main.js中设置  

Vue.prototype.bus = new Vue;

4.在.vue组件中使用

 // 显示loading
this.bus.$emit('loading', true);
 
// 关闭loading
this.bus.$emit('loading', false);

效果如下:

以上为个人经验,希望能给大家一个参考,也希望大家多多支持易盾网络。

上一篇:VUE+axios+php实现图片上传
下一篇:没有了
网友评论