longz
2026-04-28 bfa7d3b23e526809b04299d9c2719c3449aba3be
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<script lang="ts" setup>
const { loadingOptions, currentPage } = storeToRefs(useGlobalLoading())
 
const { close: closeGlobalLoading } = useGlobalLoading()
 
const loading = useToast('globalLoading')
const currentPath = getCurrentPath()
 
// #ifdef MP-ALIPAY
const hackAlipayVisible = ref(false)
 
nextTick(() => {
  hackAlipayVisible.value = true
})
// #endif
 
watch(() => loadingOptions.value, (newVal) => {
  if (newVal && newVal.show) {
    if (currentPage.value === currentPath) {
      loading.loading(loadingOptions.value)
    }
  }
  else {
    loading.close()
  }
})
</script>
 
<script lang="ts">
export default {
  options: {
    virtualHost: true,
    addGlobalClass: true,
    styleIsolation: 'shared',
  },
}
</script>
 
<template>
  <!-- #ifdef MP-ALIPAY -->
  <wd-toast v-if="hackAlipayVisible" selector="globalLoading" :closed="closeGlobalLoading" />
  <!-- #endif -->
  <!-- #ifndef MP-ALIPAY -->
  <wd-toast selector="globalLoading" :closed="closeGlobalLoading" />
  <!-- #endif -->
</template>