loading组件
这是loading的效果。。。
直接上代码吧
<template>
<div class="v-spinner" v-show="loading">
<div class="v-dot-container">
<div class="v-dot v-dot1" v-bind:style="spinnerBasicStyle">
<div class="v-dot v-dot2" v-bind:style="spinnerStyle"></div>
<div class="v-dot v-dot3" v-bind:style="spinnerStyle"></div>
<div class="v-dot v-dot4" v-bind:style="spinnerStyle"></div>
<div class="v-dot v-dot5" v-bind:style="spinnerStyle"></div>
</div>
</div>
</div>
</template>
<script>
export default {
name: "DotLoader",
props: {
loading: {
type: Boolean,
default: true,
},
size: {
type: String,
default: "60px",
},
margin: {
type: String,
default: "2px",
},
radius: {
type: String,
default: "100%",
},
},
computed: {
spinnerStyle() {
return {
height: parseFloat(this.size) / 3 + "px",
width: parseFloat(this.size) / 3 + "px",
borderRadius: this.radius,
display:'inline-block'
};
},
spinnerBasicStyle() {
return {
height: '46px',
width: '46px',
position: "relative",
};
},
},
};
</script>
<style>
.v-spinner{
position: relative;
width: 100%;
height: 100%;
background: rgba(255, 255, 255, 0.7);
}
.v-dot-container{
width: 46px;
height: 46px;
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
margin: auto;
}
.v-spinner .v-dot1 {
-webkit-animation: v-dotRotate 2s 0s infinite linear;
animation: v-dotRotate 2s 0s infinite linear;
-webkit-animation-fill-mode: forwards;
animation-fill-mode: forwards;
}
.v-dot2{
margin-right: 4px;
background-color:#f3717a ;
}
.v-dot3{
background-color: #f1b3b9;
}
.v-dot4{
margin-right: 4px;
background-color: #f2acb2;
}
.v-dot5{
background-color: #f1b3b9;
}
@-webkit-keyframes v-dotRotate {
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@keyframes v-dotRotate {
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
</style>
有个vue插件库,其实我这个loading也是拿到别人的代码来改造的,放上链接,有需要的可以去看看哦
vue插件库:https://www.vue365.cn/