页面加载过程 loading加载特效

.vue文件在查询框增加一个查询加载特效 分别需要在html、css、js中增加相应代码

  1. 首先在html中定义一个spin-box,用 v-if函数来判断是否需要加载动画
 <div class="spin-box" v-if="loading">
            <a-spin tip="数据加载中...">
              <a-icon
                slot="indicator"
                type="loading"
                style="font-size: 0.24rem"
                spin
              />
            </a-spin>
          </div>

然后在下一行代码最后加入v-else来判断加载动画是否终止。

  1. 在js中进行编辑
    首先在data函数设置
 data() {
    return {
      loading: false,//默认不显示loading
      };
  }

在async函数中设置

async getList(queryObj) {
      this.loading = true;
      try {...
      } catch (e) {
        this.loading = false;
        console.log("e");
        console.log(e);
      }
    },
dealEcharts(dataList) {
    this.loading = false;
 }
  1. css中进行格式修改
.spin-box {
    position: absolute;
    top: 0.5rem;
    left: 0;
    width: 100%;
    height: 90%;
    background: rgba(137, 137, 137, 0.3);

    .ant-spin {
      width: 100%;
      height: 100%;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
    }
  }
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值