fix(breadcrumb): 修复点击当前面包屑会跳转的缺陷

--bug=1036952 --user=吕梦园
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001036952
This commit is contained in:
teukkk 2024-04-22 15:42:42 +08:00 committed by 刘瑞斌
parent 51e5f5fe03
commit d117e72f1f
1 changed files with 10 additions and 2 deletions

View File

@ -1,6 +1,10 @@
<template> <template>
<a-breadcrumb v-if="appStore.breadcrumbList.length > 0" class="z-10 mb-[-8px]"> <a-breadcrumb v-if="appStore.breadcrumbList.length > 0" class="z-10 mb-[-8px]">
<a-breadcrumb-item v-for="crumb of appStore.breadcrumbList" :key="crumb.name" @click="jumpTo(crumb)"> <a-breadcrumb-item
v-for="(crumb, index) of appStore.breadcrumbList"
:key="crumb.name"
@click="jumpTo(crumb, index)"
>
{{ isEdit ? t(crumb.editLocale || crumb.locale) : t(crumb.locale) }} {{ isEdit ? t(crumb.editLocale || crumb.locale) : t(crumb.locale) }}
</a-breadcrumb-item> </a-breadcrumb-item>
</a-breadcrumb> </a-breadcrumb>
@ -46,7 +50,11 @@
} }
}, true); }, true);
function jumpTo(crumb: BreadcrumbItem) { function jumpTo(crumb: BreadcrumbItem, index: number) {
//
if (index === appStore.breadcrumbList.length - 1) {
return;
}
if (crumb.isBack && window.history.state.back) { if (crumb.isBack && window.history.state.back) {
router.back(); router.back();
} else { } else {