|
|
@ -40,64 +40,64 @@ export default { |
|
|
|
// if (this.$route.meta.hideBreadcrumb) return []; |
|
|
|
|
|
|
|
const crumbs = [ |
|
|
|
{ |
|
|
|
path:{ |
|
|
|
path:'/', |
|
|
|
query:{uid: "2300"}, |
|
|
|
params:{} |
|
|
|
}, |
|
|
|
title:'首页' |
|
|
|
}, |
|
|
|
{ |
|
|
|
path:{ |
|
|
|
path: "/agent/siteList", |
|
|
|
query:{uid: "2300"}, |
|
|
|
params:{} |
|
|
|
}, |
|
|
|
title:"站点列表" |
|
|
|
}, |
|
|
|
// { |
|
|
|
// path:{ |
|
|
|
// path:'/', |
|
|
|
// query:{uid: "2300"}, |
|
|
|
// params:{} |
|
|
|
// }, |
|
|
|
// title:'首页' |
|
|
|
// }, |
|
|
|
// { |
|
|
|
// path:{ |
|
|
|
// path: "/agent/siteList", |
|
|
|
// query:{uid: "2300"}, |
|
|
|
// params:{} |
|
|
|
// }, |
|
|
|
// title:"站点列表" |
|
|
|
// }, |
|
|
|
]; |
|
|
|
// let currentRoute = this.$route; |
|
|
|
let currentRoute = this.$route; |
|
|
|
|
|
|
|
// 递归查找所有父级路由 |
|
|
|
// while (currentRoute) { |
|
|
|
// // 获取匹配的路由记录 |
|
|
|
// // const matchedRoute = this.$router.options.routes.find( |
|
|
|
// // r => r.name === currentRoute.name |
|
|
|
// // ); |
|
|
|
//// 递归查找所有父级路由 |
|
|
|
while (currentRoute) { |
|
|
|
// 获取匹配的路由记录 |
|
|
|
// const matchedRoute = this.$router.options.routes.find( |
|
|
|
// r => r.name === currentRoute.name |
|
|
|
// ); |
|
|
|
|
|
|
|
// // 构建包含完整参数的对象 |
|
|
|
// const routeWithParams = { |
|
|
|
// path: currentRoute.path, |
|
|
|
// query: currentRoute.query, |
|
|
|
// params: currentRoute.params |
|
|
|
// }; |
|
|
|
// 构建包含完整参数的对象 |
|
|
|
const routeWithParams = { |
|
|
|
path: currentRoute.path, |
|
|
|
query: currentRoute.query, |
|
|
|
params: currentRoute.params |
|
|
|
}; |
|
|
|
|
|
|
|
// crumbs.unshift({ |
|
|
|
// path: routeWithParams, |
|
|
|
// title: this.getTitle(currentRoute) |
|
|
|
// }); |
|
|
|
crumbs.unshift({ |
|
|
|
path: routeWithParams, |
|
|
|
title: this.getTitle(currentRoute) |
|
|
|
}); |
|
|
|
|
|
|
|
// // 通过 meta.breadcrumbParent 查找父级路由 |
|
|
|
// if (currentRoute.meta.breadcrumbParent) { |
|
|
|
// currentRoute = this.$router.options.routes.find( |
|
|
|
// r => r.name === currentRoute.meta.breadcrumbParent |
|
|
|
// ); |
|
|
|
// 通过 meta.breadcrumbParent 查找父级路由 |
|
|
|
if (currentRoute.meta.breadcrumbParent) { |
|
|
|
currentRoute = this.$router.options.routes.find( |
|
|
|
r => r.name === currentRoute.meta.breadcrumbParent |
|
|
|
); |
|
|
|
|
|
|
|
// // 如果找到了父路由,创建一个模拟的$route对象 |
|
|
|
// if (currentRoute) { |
|
|
|
// currentRoute = { |
|
|
|
// ...currentRoute, |
|
|
|
// path: currentRoute.path, |
|
|
|
// query: this.$route.query, // 保留当前查询参数 |
|
|
|
// params: this.$route.params, // 保留当前路由参数 |
|
|
|
// meta: currentRoute.meta || {} |
|
|
|
// }; |
|
|
|
// } |
|
|
|
// } else { |
|
|
|
// currentRoute = null; |
|
|
|
// } |
|
|
|
// } |
|
|
|
// 如果找到了父路由,创建一个模拟的$route对象 |
|
|
|
if (currentRoute) { |
|
|
|
currentRoute = { |
|
|
|
...currentRoute, |
|
|
|
path: currentRoute.path, |
|
|
|
query: this.$route.query, // 保留当前查询参数 |
|
|
|
params: this.$route.params, // 保留当前路由参数 |
|
|
|
meta: currentRoute.meta || {} |
|
|
|
}; |
|
|
|
} |
|
|
|
} else { |
|
|
|
currentRoute = null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return crumbs; |
|
|
|
}, |
|
|
|