Skip to content

Instantly share code, notes, and snippets.

@pratheekhegde
Created February 17, 2018 08:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pratheekhegde/0aae4f683ea96d93b282fd5274ca6eec to your computer and use it in GitHub Desktop.
Save pratheekhegde/0aae4f683ea96d93b282fd5274ca6eec to your computer and use it in GitHub Desktop.
create-breadcrumbs-array
let breadcrumbs = pathArray.reduce((breadcrumbArray, path, idx) => {
breadcrumbArray.push({
path: path,
to: breadcrumbArray[idx - 1]
? "/" + breadcrumbArray[idx - 1].path + "/" + path
: "/" + path,
text: this.$route.matched[idx].meta.breadCrumb || path,
});
return breadcrumbArray;
}, [])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment