D
D
Danil Razumkov2018-03-17 14:29:47
HTML
Danil Razumkov, 2018-03-17 14:29:47

Different templates for vue-router?

The site has content pages and login and registration pages. So for the content, a certain static part with a header, footer and menu is used, but for the entrance and registration, another static part is needed. How to do this with vue-router?
Entry point
5aacfbbc9e4ad374201667.png
Router Is
5aacfbc18e2c0235808815.png
it possible to write something in the component itself so that it uses a different template? If not, then how to do it at all?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaly Stolyarov, 2018-03-17
@razumkov2015

You can hide the header, footer and menu by checking $route.path, $route.name or by meta data (which will be more correct) $router.meta

export default new Router({
routes: [
{
    path: '/signin',
    component: SignIn
    meta: { hideHeader: true }
}
]);

<header v-if="!$route.meta.hideHeader">
...

A
Alexander Pushkarev, 2018-03-17
@AXP-dev

I use https://github.com/ktquez/vue-extend-layout for your task. And no need to invent bicycles

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question