|
@@ -61,11 +61,17 @@ const isInWhiteList = (url, whiteList)=> {
|
|
|
}
|
|
|
|
|
|
const breadcrumbs = ref([])
|
|
|
-const getTitle = (list) => {
|
|
|
+const getTitle = (list, fullPath) => {
|
|
|
+ const _fullPath = fullPath.split('/')
|
|
|
const arr = list.map((item, index) => {
|
|
|
+ // 重组路径
|
|
|
if (item.path === list[index - 1]?.path) return false
|
|
|
const text = item.meta.title
|
|
|
- const obj = { text, to: item.path }
|
|
|
+ const _path = item.path.split('/')
|
|
|
+ const obj = {
|
|
|
+ text,
|
|
|
+ to: _path.map((e, i) => _fullPath[i]).join('/')
|
|
|
+ }
|
|
|
return obj
|
|
|
}).filter(e => e) || []
|
|
|
if (arr?.length) {
|
|
@@ -77,14 +83,15 @@ const getTitle = (list) => {
|
|
|
|
|
|
watch(
|
|
|
() => route.matched,
|
|
|
- (val) => {
|
|
|
- getTitle(val)
|
|
|
+ (val) => {
|
|
|
+ getTitle(val, route.fullPath)
|
|
|
},
|
|
|
{ immediate: true },
|
|
|
{ deep: true }
|
|
|
)
|
|
|
|
|
|
-const toPath = ({ disabled, to }) => {
|
|
|
+const toPath = (item) => {
|
|
|
+ const { disabled, to } = item
|
|
|
if (disabled) {
|
|
|
event.preventDefault()
|
|
|
return
|