[Vuejs]-How to hide/unhide the router-link button for a specific component in vuejs

3👍

You can get the path of the current route by two ways

v-if="$route.path != '/'"

or

v-if="$router.currentRoute.path != '/'"

They both returns a string that equals the path of the current route, always resolved as an absolute path.

You can check the documentation :
https://router.vuejs.org/api/#route-object-properties

You can check this fiddle: https://jsfiddle.net/Farouk_Mekkaoui/7xvpje08/12/

1👍

The answer above helped get me most of the way there but something that worked a little better for me using named routes was:

v-if="$router.currentRoute.name != 'routeNameHere'"

Leave a comment