| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <script lang="ts" setup>
- const { toastOptions, currentPage } = storeToRefs(useGlobalToast())
- const { close: closeGlobalToast } = useGlobalToast()
- const toast = useToast('globalToast')
- const currentPath = getCurrentPath()
- // #ifdef MP-ALIPAY
- const hackAlipayVisible = ref(false)
- nextTick(() => {
- hackAlipayVisible.value = true
- })
- // #endif
- watch(() => toastOptions.value, (newVal) => {
- if (newVal && newVal.show) {
- if (currentPage.value === currentPath) {
- toast.show(toastOptions.value)
- }
- }
- else {
- toast.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="globalToast" :closed="closeGlobalToast" />
- <!-- #endif -->
- <!-- #ifndef MP-ALIPAY -->
- <wd-toast selector="globalToast" :closed="closeGlobalToast" />
- <!-- #endif -->
- </template>
|