Answer the question
In order to leave comments, you need to log in
Breadcrumbs on nuxt.js?
Maybe someone knows about the finished component or is there any guide on how to make "breadcrumbs" on nuxt?
Answer the question
In order to leave comments, you need to log in
<template lang="pug">
div.breadcrumbs
router-link(
v-for="link, i in breadcrumbsLinks"
:key="i"
:to="link"
).breadcrumps__level {{link.meta.title}}
</template>
<script>
export default {
name: 'breadcrumbs',
computed: {
breadcrumbsLinks () {
let tmp = []
if (this.$route.matched) {
this.$route.matched.forEach(link => {
tmp.push(Object.assign({meta: {title: 'Title not found in meta'}}, link))
})
}
if (tmp.length === 0) {
tmp.push({path: '/', meta: {title: 'Home'}})
}
return tmp
}
}
}
</script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question