首页 > 其他分享 >vue3 css ts 双重弹跳加载动画

vue3 css ts 双重弹跳加载动画

时间:2023-06-14 15:22:33浏览次数:42  
标签:动画 const 100% ts value sk vue3 css 加载

/双重弹跳加载动画 */
效果如同页面 https://codepen.io/yjx123/pen/zYMvbML

  <a href="javascript:void(0)" @click="startLoading">
    <inline-svg :src="getAssetPath(iconPath)"></inline-svg>

    <div
      :style="{ width: spinkitSize, height: spinkitSize }"
      class="sk-double-bounce"
      v-show="loading"
    >
      <div
        class="sk-child sk-double-bounce-1"
        :style="{ backgroundColor: spinnerColor }"
      ></div>
      <div
        class="sk-child sk-double-bounce-2"
        :style="{ backgroundColor: spinnerColor }"
      ></div>
    </div>
  </a>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { getAssetPath } from "@/core/helpers/assets";
import { useI18n } from "vue-i18n";
import { ElNotification } from "element-plus";
const { t } = useI18n();
// const props = defineProps({
//   data: Object,
//   text: String,
// });  loading: boolean = true;
const spinkitSize = "16px"; // 设置加载动画的尺寸
const spinnerColor = "#13227a"; // 设置加载动画的颜色
const loading = ref(false);
const bouncing = ref(false);

const iconPath = ref("media/icons/duotune/arrows/arr00111.svg");
const startLoading = () => {
  bouncing.value = true;
  iconPath.value = "";
  loading.value = true;
  setTimeout(() => {
    bouncing.value = false;
    loading.value = false;
    iconPath.value = "media/icons/duotune/arrows/arr00111.svg";
    open4();
  }, 2000);
};
const open4 = () => {
  ElNotification({
    title: "Error",
    message: t("prompt5"),
    type: "error",
    position: "bottom-right",
  });
};
</script>
<style scoped>
user agent stylesheet a:-webkit-any-link {
  color: -webkit-link;
  cursor: pointer;
  text-decoration: underline;
}

/* /双重弹跳加载动画 */
.sk-double-bounce {
  width: 100%;
  height: 100%;
  position: relative;
  margin: auto;
  display: inline-block;
}

.sk-child {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  opacity: 0.6;
  position: absolute;
  top: 0;
  left: 0;
  animation: sk-double-bounce 2s infinite ease-in-out;
}

.sk-double-bounce-2 {
  animation-delay: -1s;
}

@keyframes sk-double-bounce {
  0%,
  100% {
    transform: scale(0);
  }
  50% {
    transform: scale(1);
  }
}
</style>

标签:动画,const,100%,ts,value,sk,vue3,css,加载
From: https://www.cnblogs.com/xxdmua/p/17480304.html

相关文章

  • [LeetCode] 1348. Tweet Counts Per Frequency 推文计数
    Asocialmediacompanyistryingtomonitoractivityontheirsitebyanalyzingthenumberoftweetsthatoccurinselectperiodsoftime.Theseperiodscanbepartitionedintosmaller timechunks basedonacertainfrequency(every minute, hour,or day......
  • An analysis of what are the drug targets for the treatment of systemic lupus ery
    Systemiclupuserythematosus(SLE)isanautoimmunediseasethatproduceslargeamountsofimmunecomplexesandautoantibodiesandcausesdamagetothekidneys,skin,joints,andcentralnervoussystem.CurrentSLEtreatmentismostlyglucocorticoid-ledd......
  • CSS动画和过渡的区别
    CSS动画和过渡都是用来实现网页元素的动态效果,但它们在实现方式和应用场景上有一些区别。CSS过渡(CSSTransitions)是在元素状态改变时实现平滑过渡效果的一种机制。过渡通过指定元素的属性变化,使元素从一个状态平滑地过渡到另一个状态。过渡通常用于响应用户操作、交互效果或状态......
  • Vue3中循环任务优化方案
    需求在使用循环任务时,往往需要使用到setInterval方法。其接受三个参数,分别是1.具体执行的函数2.执行时间间隔3.传递个函数的参数,并返回一个id,后续可以使用这个id来停止循环的执行。具体的使用可以查阅MDN。在实际开发中,很容易重复创建相同的interval实例,进行反复的执行,并且在......
  • 如何查看在当前的ingress-controller中,有哪些backend?每个backend的endpoints是什么?
    通过kubectlingress-nginx命令,可以查看在ingresscontroller中,有哪些backends,每个backends的后端的endpoints信息和对应其他的参数设置 比如: kubectlingress-nginxbackends-ningress-nginx  [root@nccztsjb-node-23data]#kubectlingress-nginxbackends-n......
  • CSS选择器的优先级和权重。
    定义:CSS选择器的优先级和权重是用来确定当多个选择器应用于同一个元素时,哪个选择器的规则将会生效。以下是CSS选择器优先级和权重的解释:CSS选择器的优先级:1.内联样式:应用于HTML元素内部的style属性,具有最高的优先级。如2.ID选择器:通过元素的id属性选择元素,如#example,具有较高的......
  • 第二节:ChatGPT提示词Prompts的设计技巧
    一.        二.        三.         !作       者:Yaopengfei(姚鹏飞)博客地址:http://www.cnblogs.com/yaopengfei/声     明1:如有错误,欢迎讨论,请勿谩骂^_^。声     明2:原创博客请在转载......
  • 5、题目:Training in Creative Problem Solving: Effects on Ideation and Problem Fin
    期刊信息(1)作者:GeorgeB.Graen,StephenG.Graen(2)期刊:OrganizationalBehaviorandHumanPerformance(3)DOI:10.1016/0030-5073(82)90233-1(4)ISSN:0030-5073   研究背景创造力训练作为工业培训的一个子集,普遍面临着工业培训研究的许多问题,也面临着一些独特的问题。......
  • css如何实现文字两端对齐效果
    想要实现文字两端对齐效果,可以使用CSS的text-align属性。设置text-align:justify;即可实现文字两端对齐效果。一、方法一给元素设置 text-align: justify;text-align-last:justify;并且加上text-justify:distribute-all-line;目的是兼容ie浏览器p{width:130px;text-al......
  • [USACO06FEB]Treats for the Cows G/S
    [USACO06FEB]TreatsfortheCowsG/S题目描述FJhaspurchasedN(1<=N<=2000)yummytreatsforthecowswhogetmoneyforgivingvastamountsofmilk.FJsellsonetreatperdayandwantstomaximizethemoneyhereceivesoveragivenperiodtime.Th......