fix: the anchor and tabs conflict

This commit is contained in:
Prototype 2024-12-18 09:12:46 +08:00
parent a97c998be5
commit 180063bd59
5 changed files with 11 additions and 11 deletions

View File

@ -15,7 +15,7 @@ defineOptions({
<KeepAlive :include="['Login']">
<component
:is="Component"
:key="route.fullPath"
:key="route.path"
class="enter-x mt-6 w-full sm:mx-auto md:max-w-md"
/>
</KeepAlive>

View File

@ -100,13 +100,13 @@ function transformComponent(
:is="transformComponent(Component, route)"
v-if="renderRouteView"
v-show="!route.meta.iframeSrc"
:key="route.fullPath"
:key="route.path"
/>
</KeepAlive>
<component
:is="Component"
v-else-if="renderRouteView"
:key="route.fullPath"
:key="route.path"
/>
</Transition>
</RouterView>

View File

@ -43,7 +43,7 @@ export function useTabbar() {
} = useTabs();
const currentActive = computed(() => {
return route.fullPath;
return route.path;
});
const { locale } = useI18n();
@ -144,7 +144,7 @@ export function useTabbar() {
{
handler: async () => {
if (!contentIsMaximize.value) {
await router.push(tab.fullPath);
await router.push(tab.path);
}
toggleMaximize();
},

View File

@ -67,7 +67,7 @@ function showSpinning(index: number) {
</script>
<template>
<template v-if="showIframe">
<template v-for="(item, index) in iframeRoutes" :key="item.fullPath">
<template v-for="(item, index) in iframeRoutes" :key="item.path">
<div
v-if="canRender(item)"
v-show="routeShow(item)"

View File

@ -58,11 +58,11 @@ export const useTabbarStore = defineStore('core-tabbar', {
* @param tab
*/
_close(tab: TabDefinition) {
const { fullPath } = tab;
const { path } = tab;
if (isAffixTab(tab)) {
return;
}
const index = this.tabs.findIndex((item) => item.fullPath === fullPath);
const index = this.tabs.findIndex((item) => item.path === path);
index !== -1 && this.tabs.splice(index, 1);
},
/**
@ -188,7 +188,7 @@ export const useTabbarStore = defineStore('core-tabbar', {
const paths: string[] = [];
for (const path of closePaths) {
if (path !== tab.fullPath) {
if (path !== tab.path) {
const closeTab = this.tabs.find((item) => getTabPath(item) === path);
if (!closeTab) {
continue;
@ -290,7 +290,7 @@ export const useTabbarStore = defineStore('core-tabbar', {
* @param tab
*/
async openTabInNewWindow(tab: TabDefinition) {
openRouteInNewWindow(tab.fullPath || tab.path);
openRouteInNewWindow(tab.path);
},
/**
@ -546,7 +546,7 @@ function isTabShown(tab: TabDefinition) {
* @param tab
*/
function getTabPath(tab: RouteRecordNormalized | TabDefinition) {
return decodeURIComponent((tab as TabDefinition).fullPath || tab.path);
return decodeURIComponent((tab as TabDefinition).path);
}
function routeToTab(route: RouteRecordNormalized) {