Antoine Kurka
Antoine Kurka

Reputation: 322

Hiding a component on some pages VueJs

I would like to hide 2 components (AppBar & NavigationDrawer) included on my App.vue from some routes like /login.

I already included this in my NavigationDrawer.vue but it's disabling the component on every routes :

<v-navigation-drawer
    permanent
    color="#2e3336"
    height="100vh"
    expand-on-hover
    v-if="!['Login'].include($route.name)">

Do I use the rigth method ?

Upvotes: 0

Views: 503

Answers (1)

Yash Maheshwari
Yash Maheshwari

Reputation: 2412

You can use something like $route.name === 'Login', as $route.name is the current route name, so you can check directly like this.

Upvotes: 1

Related Questions