Browse Source

恢复面包屑组件

develop
zq 1 month ago
parent
commit
16e13800de
  1. 106
      packages/Breadcrumb/src/index.vue

106
packages/Breadcrumb/src/index.vue

@ -37,67 +37,67 @@ export default {
},
computed: {
breadcrumbs() {
// if (this.$route.meta.hideBreadcrumb) return [];
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;
},

Loading…
Cancel
Save