Closed psntr closed 4 years ago
I'd struggled sometimes with that, then I used
This theme solves the problem using internal link deligation which is explained in detail in the readme, yet I find confusing & especially for the "active" class.
Another solution Using this method could be helpful, you will need to pass any URL of this type to that method first
function routeFromLink(url){
const siteUrl = this.$store.state.site.url
if(url.includes(siteUrl)) return url.replace(siteUrl, '')
else return '/'
}
Then in the navbar:
<route-link v-for="item in menu" :to="routeFromLink(item.url)">{{ item.content }}</route-link>
Thank you, that's a clever way to solve that. Also thank you for explaining further reason, I didn't think about the internal links. Hope someone will find this helpful!
I wanted to know why not using the
<router-link>
? We could use the benefit that comes with it, as such as the class="active" on the current & clicked nav item.How do other folks deal with the class="active" on their theme?