Skip to content

Commit

Permalink
fix: all modal should be destroy after the route change
Browse files Browse the repository at this point in the history
  • Loading branch information
buqiyuan committed Mar 14, 2024
1 parent 19d5621 commit 5dbc5eb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/layout/header/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</template>

<script lang="tsx" setup>
import { computed, nextTick, type CSSProperties } from 'vue';
import { computed, type CSSProperties } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import {
QuestionCircleOutlined,
Expand Down Expand Up @@ -113,8 +113,6 @@
// 移除标签页
localStorage.clear();
message.success('成功退出登录');
await nextTick();
console.log('router', router.getRoutes());
router.replace({
name: LOGIN_NAME,
query: {
Expand Down
2 changes: 2 additions & 0 deletions src/router/router-guards.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { NavigationFailureType, isNavigationFailure } from 'vue-router';
import NProgress from 'nprogress'; // progress bar
import { Modal } from 'ant-design-vue';
import { LOGIN_NAME, PAGE_NOT_FOUND_NAME, REDIRECT_NAME } from './constant';
import type { WhiteNameList } from './constant';
import type { Router, RouteLocationNormalized } from 'vue-router';
Expand Down Expand Up @@ -29,6 +30,7 @@ export function createRouterGuards(router: Router, whiteNameList: WhiteNameList)
const [err] = await _to(userStore.afterLogin());
if (err) {
userStore.resetToken();
Modal.destroyAll();
return next({ name: LOGIN_NAME });
}
// 解决警告:No match found for location with path "XXXXXXX"
Expand Down
1 change: 0 additions & 1 deletion src/views/system/monitor/online/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export const baseColumns: TableColumn<TableListItem>[] = [
{
title: '登录地点',
dataIndex: 'address',
width: 140,
},
{
title: '浏览器',
Expand Down

0 comments on commit 5dbc5eb

Please sign in to comment.