Browse Source

添加面包屑

YaolongHan 3 years ago
parent
commit
72cf8f8233
1 changed files with 21 additions and 0 deletions
  1. 21 0
      src/components/Breadcrumb/index.vue

+ 21 - 0
src/components/Breadcrumb/index.vue

@@ -37,12 +37,33 @@ export default class extends Vue {
     private getBreadcrumb() {
         let matched = this.$route.matched.filter((item) => item.meta && item.meta.title);
         const first = matched[0];
+        //针对关系模块添加面包屑
+        if(first) {
+        matched = this.relationModel(matched)
+        }
 
         this.breadcrumbs = matched.filter((item) => {
             return item.meta && item.meta.title && item.meta.breadcrumb !== false;
         });
     }
 
+    /**
+     * 关系模块
+     *
+     */
+    relationModel(matched:any = []){
+        if(matched.length >= 2 && matched[1].path == '/maintain/relation'){
+            matched[2] = {
+              path: "/maintain/relationship",
+              meta:{
+                  title:this.$route.query.relationTypeName,
+                  hidden: true,
+              }
+            }
+        }
+        return matched
+    }
+
     // private isDashboard(route: RouteRecord) {
     //     const name = route && route.meta && route.meta.title;
     //     return name === "Dashboard";