5 changed files with 108 additions and 17 deletions
-
54components/h-loading.vue
-
8pages/marketSituation/globalIndex.vue
-
31pages/marketSituation/marketDetail.vue
-
32pages/marketSituation/marketOverview.vue
-
BINstatic/loading-gif.gif
@ -0,0 +1,54 @@ |
|||
<!-- @format --> |
|||
|
|||
<template> |
|||
<view v-if="loading" class="loading"> |
|||
<image class="loadingGif" src="/static/loading-gif.gif" mode=""></image> |
|||
</view> |
|||
</template> |
|||
|
|||
<script setup> |
|||
import { ref, computed, onMounted,watch } from "vue"; |
|||
|
|||
// 定义 props |
|||
const props = defineProps({ |
|||
loading: { |
|||
type: Boolean, |
|||
default: false, |
|||
}, |
|||
}); |
|||
|
|||
const loading = ref(false); |
|||
|
|||
// 监听 props.loading 变化 |
|||
watch(() => props.loading, (newVal) => { |
|||
loading.value = newVal; |
|||
}); |
|||
|
|||
// 生命周期 |
|||
onMounted(() => { |
|||
loading.value = props.loading; |
|||
}); |
|||
</script> |
|||
|
|||
<style scoped> |
|||
.loading { |
|||
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; |
|||
z-index: 9999; |
|||
display: flex; |
|||
justify-content: center; |
|||
align-items: center; |
|||
} |
|||
|
|||
.loadingGif { |
|||
width: 100rpx; |
|||
height: 100rpx; |
|||
} |
|||
</style> |
|||
|
After Width: 120 | Height: 120 | Size: 134 KiB |
Write
Preview
Loading…
Cancel
Save
Reference in new issue