[Question] access meta
params in component
#1796
-
I am trying to conditionally render the NavBar by checking for truthyness of a meta field. {
path: '/login',
name: 'Login',
component: () => import('../views/Login.vue'),
meta: {
hidNav: true, # SOLVED: spelling error, should be `hideNav`
},
},
{
path: '/logout',
name: 'Logout',
component: () => import('../views/Login.vue'),
props: { logout: true },
meta: {
hidNav: true, # SOLVED: spelling error, should be `hideNav`
},
}, And here is <template>
<v-app>
<NavBar v-if="!hideNav" />
<v-main>
<router-view />
</v-main>
<Footer />
</v-app>
</template>
<script setup>
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import Footer from './components/Footer.vue';
import NavBar from './components/NavBar.vue';
const route = useRoute();
const hideNav = computed(() => route.meta.hideNav);
</script> |
Beta Was this translation helpful? Give feedback.
Answered by
posva
Apr 14, 2023
Replies: 1 comment 5 replies
-
What is the question? |
Beta Was this translation helpful? Give feedback.
5 replies
Answer selected by
Pk13055
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is the question?