Files
FastapiAdmin/frontend/app/src/components/GlobalMessage.vue
T
zhangtao 66d8fcad87 feat: 初始化前端项目基础结构
- 添加项目配置文件(tsconfig, eslint, prettier等)
- 实现基础路由和页面布局
- 添加全局状态管理和API请求封装
- 集成UI组件库和主题系统
- 添加文档网站和示例页面
- 配置CI/CD和工作流
2026-05-01 01:05:16 +08:00

56 lines
1.2 KiB
Vue

<script lang="ts" setup>
import { deepClone, isFunction } from 'wot-design-uni/components/common/util'
const { messageOptions, currentPage } = storeToRefs(useGlobalMessage())
const messageBox = useMessage('globalMessage')
const currentPath = getCurrentPath()
// #ifdef MP-ALIPAY
const hackAlipayVisible = ref(false)
nextTick(() => {
hackAlipayVisible.value = true
})
// #endif
watch(() => messageOptions.value, (newVal) => {
if (newVal) {
if (currentPage.value === currentPath) {
const option = deepClone(newVal)
messageBox.show(option).then((res) => {
if (isFunction(option.success)) {
option.success(res)
}
}).catch((err) => {
if (isFunction(option.fail)) {
option.fail(err)
}
})
}
}
else {
messageBox.close()
}
})
</script>
<script lang="ts">
export default {
options: {
virtualHost: true,
addGlobalClass: true,
styleIsolation: 'shared',
},
}
</script>
<template>
<!-- #ifdef MP-ALIPAY -->
<wd-message-box v-if="hackAlipayVisible" selector="globalMessage" />
<!-- #endif -->
<!-- #ifndef MP-ALIPAY -->
<wd-message-box selector="globalMessage" />
<!-- #endif -->
</template>