Files
nanocode/wanandroid/uniapp/components/common/loading.vue
T
Ubuntu 32b43f85bd a
2026-07-03 16:58:28 +08:00

99 lines
1.7 KiB
Vue

<template>
<view class="loading-container" v-if="visible">
<view class="loading-content">
<view class="loading-spinner">
<view class="spinner"></view>
</view>
<text class="loading-text">{{ text }}</text>
</view>
</view>
</template>
<script>
export default {
name: 'CommonLoading',
props: {
// 是否显示
visible: {
type: Boolean,
default: false
},
// 加载文本
text: {
type: String,
default: '加载中...'
},
// 背景是否透明
transparent: {
type: Boolean,
default: false
},
// 是否全屏
fullscreen: {
type: Boolean,
default: false
}
},
data() {
return {}
}
}
</script>
<style scoped>
.loading-container {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
justify-content: center;
align-items: center;
z-index: 9999;
background-color: rgba(255, 255, 255, 0.9);
}
.loading-container.transparent {
background-color: transparent;
}
.loading-container.fullscreen {
position: fixed;
}
.loading-content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 40rpx;
background-color: #ffffff;
border-radius: 16rpx;
box-shadow: 0 4rpx 24rpx rgba(0, 0, 0, 0.1);
}
.loading-spinner {
margin-bottom: 20rpx;
}
.spinner {
width: 60rpx;
height: 60rpx;
border: 6rpx solid #f3f3f3;
border-top: 6rpx solid #3cc51f;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.loading-text {
font-size: 28rpx;
color: #666;
text-align: center;
}
</style>