# 多个请求时的加载状态

本文作者:阳九五 (opens new window)

本站地址:https://blog.56321654.xyz (opens new window)

/** Start: Loading */
const allLoading = reactive({
    delData: false,
    getTicketDashboard: false
});
const loading = ref(false);
const loadingTime = ref(new Date().getTime());
watch(() => allLoading, () => {
    loading.value = true;
    loadingTime.value = new Date().getTime();
    debounceLoadingAnimation();
},{ deep: true });
function LoadingAnimation(){
    setTimeout(() => {
        loading.value = Object.values(allLoading).some(value => value === true);
    }, Math.max(500 - ((new Date().getTime()) - loadingTime.value) / 1000), 0)
}
const debounceLoadingAnimation = debounce(LoadingAnimation,100);
/** Start: Loading */
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
最近更新: 8/6/2025, 2:39:35 PM
多个请求时的加载状态