wanmeiyizhan/components/customLoading.vue
2025-04-17 19:53:09 +08:00

70 lines
1.3 KiB
Vue

<template>
<view class="custom-loading" v-if="visible">
<view class="centerContent">
<image class="loading-icon" src="/static/icon/logotransparent.png" />
<text class="loading-text">{{ text }}</text>
</view>
</view>
</template>
<script>
export default {
props: {
visible: Boolean,
text: {
type: String,
default: "加载中...",
},
},
};
</script>
<style>
.custom-loading {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
/* background: rgba(0, 0, 0, 0.5); */
display: flex;
justify-content: center;
align-items: center;
z-index: 9999999;
width: 100vw;
height: 100vh;
}
.centerContent {
width: 100px;
height: 100px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background: rgba(0, 0, 0, 0.5);
border-radius: 18rpx;
box-sizing: border-box;
padding: 16rpx;
}
.loading-icon {
width: 50px;
height: 50px;
animation: spinZ 3s linear infinite; /* 添加旋转动画 */
}
@keyframes spinZ {
0% {
transform: rotateY(0deg); /* 从 0 度开始 */
}
50% {
transform: rotateY(180deg); /* 旋转到 360 度 */
}
100% {
transform: rotateY(0deg); /* 旋转到 360 度 */
}
}
.loading-text {
color: white;
margin-top: 10px;
font-size: 28rpx;
}
</style>