Skip to content

Commit

Permalink
docs: add feat set parent
Browse files Browse the repository at this point in the history
  • Loading branch information
Scrum committed Jun 1, 2020
1 parent 09bad28 commit 978bdb8
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
19 changes: 19 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@

[![npm downloads](https://img.shields.io/npm/dm/vue-2-breadcrumbs.svg?style=flat-square)](https://www.npmjs.com/package/vue-2-breadcrumbs)[![npm](https://img.shields.io/npm/dt/vue-2-breadcrumbs.svg?style=flat-square)](https://www.npmjs.com/package/vue-2-breadcrumbs)

## Support
- Setting parent route without need to actually nest it in children array
- Customized template
- Dynamic breadcrumbs
- Dynamic label
- Shorthand labeling (`breadcrumb: 'Page Label'`)
- Sub-routing


## Install

```bash
Expand Down Expand Up @@ -75,6 +84,16 @@ const router = new VueRouter({
return `name "${name}" of context route`;
}
}
},
{
path: '/parent',
component: { template: '<router-view/>' },
meta: {
breadcrumb: {
label: 'Parent to Params',
parent: 'Params'
}
},
}
]
});
Expand Down
9 changes: 7 additions & 2 deletions src/docs/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
</ul>
</li>
</ul>
<ul>
<li>
<router-link to="/parent">Parent</router-link>
</li>
</ul>
</div>
</nav>
<main>
Expand Down Expand Up @@ -59,12 +64,12 @@ li {text-align: left;}
color: #2c3e50;
content: '/';
}
.breadcrumb-item .active {
.breadcrumb-item a {
font-weight: bold;
color: #2c3e50;
text-decoration: none;
}
.router-link-exact-active.active {
.breadcrumb-item span {
color: #42b983;
}
main {
Expand Down
10 changes: 10 additions & 0 deletions src/docs/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@ const routes: Array<RouteConfig> = [
]
}
]
},
{
path: '/parent',
component: { template: '<router-view/>' },
meta: {
breadcrumb: {
label: 'Parent to settings',
parent: 'settings'
}
},
}
]

Expand Down

0 comments on commit 978bdb8

Please sign in to comment.