|
|
@@ -80,35 +80,26 @@ function useTabs() {
|
|
|
}
|
|
|
|
|
|
function closeRight(index: number) {
|
|
|
- const currentRouterIndex = tabsKeys.value.indexOf(router.currentRoute.value.name)
|
|
|
- if (currentRouterIndex > -1 && index < currentRouterIndex) {
|
|
|
- routerPush(index)
|
|
|
- }
|
|
|
tabs.value.splice(index + 1, tabsKeys.value.length - 1);
|
|
|
+ router.push(tabs.value[tabs.value.length - 1].path)
|
|
|
}
|
|
|
|
|
|
function closeLeft(index: number) {
|
|
|
- const currentRouterIndex = tabsKeys.value.indexOf(router.currentRoute.value.name)
|
|
|
- if (currentRouterIndex > -1 && index > currentRouterIndex) {
|
|
|
- routerPush(index)
|
|
|
- }
|
|
|
- tabs.value.splice(0, index - 1);
|
|
|
+ tabs.value.splice(0, index);
|
|
|
+ router.push(tabs.value[0].path)
|
|
|
}
|
|
|
|
|
|
function closeAll() {
|
|
|
- router.push("/").then(() => {
|
|
|
- })
|
|
|
- tabs.value.splice(0, tabsKeys.value.length - 1);
|
|
|
+ router.push("/").then(() => {})
|
|
|
+ tabs.value = []
|
|
|
}
|
|
|
|
|
|
-
|
|
|
function isActive(name: string) {
|
|
|
return name === router.currentRoute.value.name
|
|
|
}
|
|
|
|
|
|
function closeOther(index: number) {
|
|
|
- routerPush(index)
|
|
|
- tabs.value = tabsKeys.value[index]
|
|
|
+ tabs.value = []
|
|
|
}
|
|
|
|
|
|
return {
|