Static element with vuerouter

Asked

Viewed 45 times

0

I have an application that uses Vue-router, but it also has the need to login, and with this login comes the change in the header, where will be login and register, or panel, but in specific cases.

I am using Vue router, is there any way this static element change only when set the variable in Session? or there is an element that can be used as a template within a Vue application to be redecorated once?

I don’t know how to solve this problem, if you can help me, thank you.

  • 1

    Can you give more details? It’s not very clear how your application is built.

  • I am using SPA, and I make a query, and I want some links to be available if logged in, and others to login and register if not. Also I want the layout, as a template, to be dynamic, using Vue to rederizate, but without reloading and avoid placing a code on all pages to be rederized.

1 answer

3

Voce can use the v-if="this.$route.name.match('route-name')", in this case, the block will only appear if the route has the same name as the current route.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.