Files
iot_web/src/components/GlobalLoading/index.vue

84 lines
1.4 KiB
Vue
Raw Normal View History

<template>
<div v-if="visible" class="global-loading">
<div class="loading-mask">
<div class="loading-content">
<div class="loading-spinner"></div>
<p class="loading-text">{{ text }}</p>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'GlobalLoading',
data() {
return {
visible: false,
text: '加载中...'
}
},
methods: {
show(text = '加载中...') {
this.text = text
this.visible = true
},
hide() {
this.visible = false
}
}
}
</script>
<style scoped>
.global-loading {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 9999;
}
.loading-mask {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;
}
.loading-content {
background: white;
padding: 20px 30px;
border-radius: 8px;
text-align: center;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}
.loading-spinner {
width: 40px;
height: 40px;
margin: 0 auto 10px;
border: 3px solid #f3f3f3;
border-top: 3px solid #0f73ee;
border-radius: 50%;
animation: spin 1s linear infinite;
}
.loading-text {
margin: 0;
font-size: 14px;
color: #666;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>