mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-04-23 23:57:22 +08:00
🎈 perf: 优化加载 升级vue3.5 electron32等多个包 添加v-loading指令
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
<!-- -->
|
||||
<template>
|
||||
<div v-if="isShow" class="loading-box">
|
||||
<div class="mask" :style="{ background: maskBackground }"></div>
|
||||
<div class="loading-content-box">
|
||||
<n-spin size="small" />
|
||||
<div :style="{ color: textColor }" class="tip">{{ tip }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { NSpin } from 'naive-ui';
|
||||
import { ref } from 'vue';
|
||||
|
||||
defineProps({
|
||||
tip: {
|
||||
type: String,
|
||||
default() {
|
||||
return '加载中...';
|
||||
},
|
||||
},
|
||||
maskBackground: {
|
||||
type: String,
|
||||
default() {
|
||||
return 'rgba(0, 0, 0, 0.8)';
|
||||
},
|
||||
},
|
||||
loadingColor: {
|
||||
type: String,
|
||||
default() {
|
||||
return 'rgba(255, 255, 255, 1)';
|
||||
},
|
||||
},
|
||||
textColor: {
|
||||
type: String,
|
||||
default() {
|
||||
return 'rgba(255, 255, 255, 1)';
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const isShow = ref(false);
|
||||
const show = () => {
|
||||
isShow.value = true;
|
||||
};
|
||||
const hide = () => {
|
||||
isShow.value = false;
|
||||
};
|
||||
defineExpose({
|
||||
show,
|
||||
hide,
|
||||
isShow,
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.loading-box {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
z-index: 9999;
|
||||
.n-spin {
|
||||
// color: #ccc;
|
||||
}
|
||||
.mask {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.loading-content-box {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.tip {
|
||||
font-size: 14px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user