fix: 优化面包屑跳转
This commit is contained in:
parent
582ebddd21
commit
e969b3911f
|
@ -11,7 +11,7 @@
|
||||||
<template #breadcrumbRender="slotProps">
|
<template #breadcrumbRender="slotProps">
|
||||||
<a
|
<a
|
||||||
v-if="slotProps.route.index !== 0 && !slotProps.route.isLast"
|
v-if="slotProps.route.index !== 0 && !slotProps.route.isLast"
|
||||||
@click='() => jumpPage(slotProps.route.path)'
|
@click='jump(slotProps.route)'
|
||||||
>
|
>
|
||||||
{{ slotProps.route.breadcrumbName }}
|
{{ slotProps.route.breadcrumbName }}
|
||||||
</a>
|
</a>
|
||||||
|
@ -89,14 +89,31 @@ const findRouteMeta = (code: string) => {
|
||||||
return meta
|
return meta
|
||||||
}
|
}
|
||||||
|
|
||||||
const jumpPage = (path: string) => {
|
const jump = (item: any) => {
|
||||||
|
let path = history.state.back
|
||||||
|
if (path) {
|
||||||
|
// 包含query参数,清除?参数
|
||||||
|
if (path.includes('?')) {
|
||||||
|
const _path = path.split('?')[0]
|
||||||
|
path = _path === item.path ? path : item.path
|
||||||
|
} else if (path !== item.path) {
|
||||||
|
path = item.path
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
path = item.path
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(item, history.state)
|
||||||
console.log(path)
|
console.log(path)
|
||||||
|
// jumpPage(slotProps.route.path)
|
||||||
router.push(path)
|
router.push(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
const breadcrumb = computed(() =>
|
const breadcrumb = computed(() =>
|
||||||
{
|
{
|
||||||
const paths = router.currentRoute.value.name as string
|
const paths = router.currentRoute.value.name as string
|
||||||
|
console.log(router.currentRoute)
|
||||||
|
console.log(route)
|
||||||
const metas = findRouteMeta(paths)
|
const metas = findRouteMeta(paths)
|
||||||
return metas.map((item, index) => {
|
return metas.map((item, index) => {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -3700,8 +3700,8 @@ jetlinks-store@^0.0.3:
|
||||||
|
|
||||||
jetlinks-ui-components@^1.0.5:
|
jetlinks-ui-components@^1.0.5:
|
||||||
version "1.0.5"
|
version "1.0.5"
|
||||||
resolved "http://47.108.170.157:9013/jetlinks-ui-components/-/jetlinks-ui-components-1.0.5.tgz#6dc396bc8a1b6f5a08accf5f46aec2099c15f481"
|
resolved "http://47.108.170.157:9013/jetlinks-ui-components/-/jetlinks-ui-components-1.0.5.tgz#5e233e915f41ec48c63c5633ef5768253cbe8ee0"
|
||||||
integrity sha512-mnVN6MfHfyZf82miEoZV8+ud6RBH29x0A8PfpcraFQUl9Wat6XcjGppr8FOkmFbGw8laCGK5jlbiX3cYJUwaxw==
|
integrity sha512-7GzacUi+9c28SBWs9UyKL8IoVaT2nTdVQbmsmfdyhjaf6QpQpdLZpT1F5UQsmPtC4C3Hg88pb9R5wQkTJ+pcCw==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@vueuse/core" "^9.12.0"
|
"@vueuse/core" "^9.12.0"
|
||||||
ant-design-vue "^3.2.15"
|
ant-design-vue "^3.2.15"
|
||||||
|
|
Loading…
Reference in New Issue