|
|
@ -1,5 +1,5 @@ |
|
|
|
import html from "html"; |
|
|
|
import { defineAsyncComponent, ref, nextTick } from "vue"; |
|
|
|
import { defineAsyncComponent, ref, nextTick, getCurrentInstance } from "vue"; |
|
|
|
import { useRoute, onBeforeRouteUpdate, useRouter } from "vue-router"; |
|
|
|
import { useAppStore } from "../store/index.js"; |
|
|
|
|
|
|
@ -111,11 +111,17 @@ export default { |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
const deleteItem = (start, end) => { |
|
|
|
appStore.routes.splice(start, end); |
|
|
|
const vue = getCurrentInstance(); |
|
|
|
console.log(vue); |
|
|
|
}; |
|
|
|
|
|
|
|
const remove = (name) => { |
|
|
|
if (appStore.routes.length > 1) { |
|
|
|
const index = appStore.routes.findIndex((o) => o.fullPath === name); |
|
|
|
const currentIndex = appStore.routes.findIndex((o) => o.fullPath === currentRoute.fullPath); |
|
|
|
appStore.routes.splice(index, 1); |
|
|
|
deleteItem(index, 1); |
|
|
|
if (index === currentIndex) { |
|
|
|
if (appStore.routes[index]) { |
|
|
|
router.push(appStore.routes[index]); |
|
|
@ -129,7 +135,7 @@ export default { |
|
|
|
const removeLeft = (index) => { |
|
|
|
const currentIndex = appStore.routes.findIndex((o) => o.fullPath === currentRoute.fullPath); |
|
|
|
const route = appStore.routes[index]; |
|
|
|
appStore.routes.splice(0, index); |
|
|
|
deleteItem(0, index); |
|
|
|
if (currentIndex < index) { |
|
|
|
router.push(route); |
|
|
|
} |
|
|
@ -137,7 +143,7 @@ export default { |
|
|
|
|
|
|
|
const removeRight = (index) => { |
|
|
|
const currentIndex = appStore.routes.findIndex((o) => o.fullPath === currentRoute.fullPath); |
|
|
|
appStore.routes.splice(index + 1, appStore.routes.length - index); |
|
|
|
deleteItem(index + 1, appStore.routes.length - index); |
|
|
|
if (currentIndex > index) { |
|
|
|
router.push(appStore.routes[index]); |
|
|
|
} |
|
|
|