Skip to content

Commit

Permalink
docs: small update
Browse files Browse the repository at this point in the history
  • Loading branch information
Scrum committed Jun 24, 2019
1 parent cd41adc commit 1b93d4d
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ Vue.use(Breabcrumbs);
### Browser

```html
<!-- Include after Vue -->
<!-- Local files -->
<script src="vue-2-breadcrumbs/dist/vue-2-breadcrumbs.js"></script>

<!-- From CDN -->
<script src="https://unpkg.com/vue-2-breadcrumbs.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-2-breadcrumbs/dist/vue-2-breadcrumbs.min.js"></script>
<script>
// As a plugin
Vue.use(VueBreadcrumbs.VueBreadcrumbsPlugin);
</script>
```

## Example
Expand All @@ -50,6 +50,7 @@ const Biz = {template: '<div><h2>Biz</h2></div>'};
const Foo = {template: '<div><h2>Foo</h2></div>'};
const Bar = {template: '<div><h2>Bar</h2></div>'};
const Baz = {template: '<div><h2>Baz</h2></div>'};
const View = {template: '<div><h2>{{ $route.params }}</h2></div>'};

const router = new VueRouter({
routes: [
Expand Down Expand Up @@ -95,7 +96,18 @@ const router = new VueRouter({
component: Feed,
meta: {
breadcrumb: routeParams => `Other Feed ${routeParams.id}`
}
},
redirect: {
name: 'view'
},
children: [{
path: 'view',
name: 'view',
component: View,
meta: {
breadcrumb: 'View'
}
}]
}
]
}
Expand Down Expand Up @@ -137,7 +149,7 @@ Vue.use(VueBreadcrumbs, {
' <nav v-if="$breadcrumbs.length" aria-label="breadcrumb">\n' +
' <ol class="breadcrumb">\n' +
' <li v-for="(crumb, key) in $breadcrumbs" v-if="crumb.meta.breadcrumb" :key="key" class="breadcrumb-item active" aria-current="page">\n' +
' <router-link :to="{ path: crumb.path }">{{ getBreadcrumb(crumb.meta.breadcrumb) }}</router-link>' +
' <router-link :to="{ path: getPath(crumb) }">{{ getBreadcrumb(crumb.meta.breadcrumb) }}</router-link>' +
' </li>\n' +
' </ol>\n' +
' </nav>'
Expand Down

0 comments on commit 1b93d4d

Please sign in to comment.