Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dont show menu on register/login page in vue

I have a side menu which i don't want to show in login/register page and I need to show it in almost all other pages. How do i go about it?

<div id="app ui container">
    <Menu/>
    <router-view/>
</div>
like image 222
Mayank Singh Fartiyal Avatar asked Dec 14 '22 19:12

Mayank Singh Fartiyal


1 Answers

There are far better ways to handle this, but since you are not sharing your code you can use something like this:

computed: {
 hide () {
   return this.$route.path === '/login' || this.$route.path === '/register'; 
 }
}

Alternatively you can still use hide/show on the element itself as:

 <Menu v-if='this.$route.path !== "login" || this.$route.path !== "/register"'/>

but that is even far less recommended

like image 67
samayo Avatar answered Dec 16 '22 10:12

samayo