- Vue-Router
- Vuex
- Element UI
- Node-Scss
- create file at
src/layouts
such as:
<template>
<div class="my-custom-layout">
<slot /> <!-- this will render everything here -->
</div>
</template>
<script>
export default {
name: 'my-custom-layout'
}
</script>
<style lang="scss" scoped>
</style>
- go to
src/router/index.js
- add the following to any route to use the newly created layout:
meta: {
layout: 'my-layout'
}
- go to
src/main.js
and add the following:
import MyCustomLayout from "./layouts/MyCustomLayout.vue";
Vue.component(`${MyCustomLayout.name}-layout`, MyCustomLayout); // you have to add `-layout` in the end
{
path: "/",
name: "Home",
meta: {
layout: "with-sidebar"
},
component: Home
},
Note: if you didn't specify the layout the
src/layouts/default.vue
will be used instead
npm install
npm run serve
npm run build
npm run lint