Skip to content

Commit 7228068

Browse files
author
allen
committed
feat: 标签页优化
1 parent f6abf56 commit 7228068

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/components/layout/Header.vue

+6-1
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,13 @@ function tabClick(val: number | string = 0, delay = true) {
2929
}
3030
setTimeout(
3131
() => {
32+
const parsedUrl = new URL(fullPath, window.location.origin) // 使用当前域名和路径
33+
const path = parsedUrl.pathname
34+
const query = Object.fromEntries(new URLSearchParams(parsedUrl.search) as any)
35+
3236
router.push({
33-
fullPath,
37+
path,
38+
query,
3439
})
3540
},
3641
delay ? 200 : 0,

src/layouts/default.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ const { tabs } = useStore('app')
44
const router = useRouter()
55
const routes = router.getRoutes()
66
const needCacheRouteNames = routes
7-
.filter((item) => item.meta && !item.meta.notCache)
8-
.map((item) => item.fullPath)
7+
.filter((item) => item.name && item.meta && !item.meta.notCache)
8+
.map((item) => item.name)
99
1010
const cacheList = computed(() => {
1111
const arr = tabs.value

0 commit comments

Comments
 (0)