Vue3 加载中。。。 Loading 组件封装 (可以根据自己需求修改该组件)

本文介绍了如何在Vue应用中创建一个简单的动画加载组件,用于显示数据加载状态,用户可以自定义样式以满足不同需求,使用CSS3动画实现转圈效果。
摘要由CSDN通过智能技术生成
<template>
  <div class="container">
    <div class="tip" v-if="page > total && tipFlag">没有更多数据了</div>
    <div class="loading-box" v-if="loadingFlag && page <= total">
      <div class="loading"></div>
    </div>
  </div>
</template>
<script setup>
import { ref } from "vue";
const props = defineProps({
  page: Number, //接受页数
  total: Number, //接收总页数
  loadingFlag: Boolean, //是否正在加载数据
  tipFlag: Boolean, //是否显示 "没有更多数据的提示"
});
</script>
<style lang="scss">
.container {
  .tip {
    color: #858a99;
    font-size: 14px;
    text-align: center;
    margin: 5px;
  }
  .loading-box {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 6px;

    .loading {
      width: 30px;
      height: 30px;
      border: 2px solid #858a99;
      border-top-color: transparent;
      border-radius: 100%;
      text-align: center;

      animation: circle infinite 0.75s linear;
    }

    // 转转转动画
    @keyframes circle {
      0% {
        transform: rotate(0);
      }
      100% {
        transform: rotate(360deg);
      }
    }
  }
}
</style>

简单的一个动画 组件 加载 类似转圈 可以根据自己的需求来写

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值