mirror of
https://github.com/XiaoDaiGua-Ray/ray-template.git
synced 2025-04-05 19:42:07 +08:00
fix: 修复 closeAll
方法在特殊情况下不能正确的关闭标签页并且跳转至 root path
的问题
This commit is contained in:
parent
b41d0490ca
commit
b97e2ee701
@ -54,6 +54,7 @@
|
|||||||
- 修复读取默认缓存语言的时候没有正确使用 `APP_CATCH_KEY.localeLanguage` 的问题
|
- 修复读取默认缓存语言的时候没有正确使用 `APP_CATCH_KEY.localeLanguage` 的问题
|
||||||
- 修复 `RTable` 全屏没有正确弹出提示信息问题
|
- 修复 `RTable` 全屏没有正确弹出提示信息问题
|
||||||
- 修复面包屑 `fullPath` 在平级模式下追加时为绑定问题
|
- 修复面包屑 `fullPath` 在平级模式下追加时为绑定问题
|
||||||
|
- 修复 `closeAll` 方法在特殊情况下不能正确的关闭标签页并且跳转至 `root path` 的问题
|
||||||
|
|
||||||
## 4.5.0
|
## 4.5.0
|
||||||
|
|
||||||
|
@ -10,9 +10,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { useMenuGetters, useMenuActions } from '@/store'
|
import { useMenuGetters, useMenuActions } from '@/store'
|
||||||
import { redirectRouterToDashboard } from '@/router/helper/routerCopilot'
|
import { useVueRouter, useAppRoot } from '@/hooks'
|
||||||
|
import { pick } from '@/utils'
|
||||||
|
|
||||||
import type { MenuTagOptions, Key } from '@/types'
|
import type { MenuTagOptions, Key, AppMenuOption } from '@/types'
|
||||||
|
|
||||||
export type CloseMenuTag = Key | MenuTagOptions
|
export type CloseMenuTag = Key | MenuTagOptions
|
||||||
|
|
||||||
@ -84,8 +85,12 @@ const normalMenuTagOption = (target: CloseMenuTag, fc: string) => {
|
|||||||
|
|
||||||
export function useSiderBar() {
|
export function useSiderBar() {
|
||||||
const { getMenuTagOptions, getMenuKey } = useMenuGetters()
|
const { getMenuTagOptions, getMenuKey } = useMenuGetters()
|
||||||
const { changeMenuModelValue, spliceMenTagOptions, setMenuTagOptions } =
|
const {
|
||||||
useMenuActions()
|
changeMenuModelValue,
|
||||||
|
spliceMenTagOptions,
|
||||||
|
setMenuTagOptions,
|
||||||
|
resolveOption,
|
||||||
|
} = useMenuActions()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -186,7 +191,33 @@ export function useSiderBar() {
|
|||||||
*/
|
*/
|
||||||
const closeAll = () => {
|
const closeAll = () => {
|
||||||
spliceMenTagOptions(0, getMenuTagOptions.value.length)
|
spliceMenTagOptions(0, getMenuTagOptions.value.length)
|
||||||
nextTick(redirectRouterToDashboard)
|
|
||||||
|
const { getRootPath } = useAppRoot()
|
||||||
|
const {
|
||||||
|
router: { getRoutes },
|
||||||
|
} = useVueRouter()
|
||||||
|
|
||||||
|
const findMenuOption = getRoutes().find(
|
||||||
|
(curr) => curr.path === getRootPath.value,
|
||||||
|
)
|
||||||
|
|
||||||
|
if (findMenuOption) {
|
||||||
|
const pickOption = pick(findMenuOption, [
|
||||||
|
'children',
|
||||||
|
'meta',
|
||||||
|
'path',
|
||||||
|
'name',
|
||||||
|
'redirect',
|
||||||
|
]) as unknown as AppMenuOption
|
||||||
|
|
||||||
|
changeMenuModelValue(
|
||||||
|
pickOption.path,
|
||||||
|
resolveOption({
|
||||||
|
...pickOption,
|
||||||
|
fullPath: pickOption.path,
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,6 +82,7 @@ export const useMenuActions = () => {
|
|||||||
collapsedMenu,
|
collapsedMenu,
|
||||||
spliceMenTagOptions,
|
spliceMenTagOptions,
|
||||||
setMenuTagOptions,
|
setMenuTagOptions,
|
||||||
|
resolveOption,
|
||||||
} = piniaMenuStore()
|
} = piniaMenuStore()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -89,5 +90,6 @@ export const useMenuActions = () => {
|
|||||||
collapsedMenu,
|
collapsedMenu,
|
||||||
spliceMenTagOptions,
|
spliceMenTagOptions,
|
||||||
setMenuTagOptions,
|
setMenuTagOptions,
|
||||||
|
resolveOption,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -363,6 +363,7 @@ export const piniaMenuStore = defineStore(
|
|||||||
collapsedMenu,
|
collapsedMenu,
|
||||||
spliceMenTagOptions,
|
spliceMenTagOptions,
|
||||||
setMenuTagOptions,
|
setMenuTagOptions,
|
||||||
|
resolveOption,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user