I'm using Vue.js app with vue-router in a 3-part component:
App.vue:
<template>
<div id="app">
<head>
</head>
<NavbarComp/>
<div>
<div class="middle">
<router-view/>
</div>
</div>
<FooterComp/>
</div>
</template>
The <NavbarComp/> contains a login button, which I'd like to appear only on landing page:
<template>
<div>
<nav>
<router-link to="/" >
<h3>My Shining app </h3>
</router-link>
<router-link to="/login">
<button v-if="section='landing'"> Login</button>
</router-link>
</nav>
</div>
</template>
I tried to define a section in the store, and define the section as a computed property on each component:
section () {
this.$store.section = 'login';
}
but could not succeed. So appreciate your hints.
v-if="this.$route.name === 'login-route-name'"v-if="this.$route.name === 'landing'". Please asnwer and I'll accept. Thanks!