| 1234567891011121314151617181920212223242526272829303132 |
- <template>
- <router-view />
- </template>
- <script lang="ts" setup>
- import { useNavigation } from '@mobile/router/navigation'
- import { dialog } from '@/utils/vant'
- import { useLogin } from '@/business/login'
- import eventBus from '@/services/bus'
- const { userLogout } = useLogin()
- const { backHome } = useNavigation()
- // 接收用户登出通知
- eventBus.$on('LogoutNotify', (msg) => {
- userLogout(() => {
- if (msg) {
- dialog({
- message: msg as string,
- confirmButtonText: '确定'
- }).then(() => {
- // ---待处理---
- // 登出后应该回退到首页,如果回退后非首页,会导致路由拦截而跳转到登录页面,此时因为 tabIndex = 0 的问题,登录页被 replace 成首页,导致路由还能继续后退
- // 临时解决方案是先退回首页后再进行登出操作
- backHome()
- })
- } else {
- backHome()
- }
- })
- })
- </script>
|