Answer the question
In order to leave comments, you need to log in
How to implement pages based on different templates in vue.js?
Good afternoon!
At the moment, all pages on my site are divided into 2 types (blade-template).
<router-view></router-view>
or into a special subcomponent <page-content></page-content>
, the component of the required current page. import VueRouter from 'vue-router';
let Welcome = require('./components/Welcome.vue');
let Contacts = require('./components/Contacts.vue');
let routes = [
{
path: '/',
component: Welcome
},
{
path: '/contacts',
component: Contacts
}
];
export default new VueRouter({routes});
Answer the question
In order to leave comments, you need to log in
As an option, create template #2 using the slot:
<template>
<div>
<header></header>
<sidebar></sidebar>
<slot name="content"></slot>
</div>
</template>
<!-- some page -->
<my-layout>
<div slot="content">
<!-- page content -->
</div>
</my-layout>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question