I used to have my URL look like this
http://localhost:8080/url-groups/edit/14
Now they look like this
http://localhost:8080/#/url-groups/edit/14
This fn used to slice it up nicely
links: function () {
return [
{ text: 'Home', disabled: false, href: '/' },
// { text: this.title, disabled: true, href: 'breadcrumbs_link_2' },
...new URL(window.location.href).pathname
.split('/')
.slice(1)
.map((seg) => ({ text: seg, disabled: false, href: seg }))
]
}
To Home > URL Group > Edit > 14
How can I modify above fn() to work with my new URL format ?
Split the pathname by / replace '' by Home then join them using >
:
links: function () {
return new URL(window.location.href).pathname.split('/')
.map(token=>token?token:'Home')
.join(' > ')
}