-
Create
layouts
a folder (no need to create if there is one) -
Created in the layouts folder
DefaultLayout.vue
-
DefaultLayout.vue
The code is as follows:
<template>
<div>
<div class="header"> header </div>
<Nuxt></Nuxt>
<div class="header"> footer </div>
</div>
</template>
<script>
export default {
}
</script>
<style>
.header {
background-color: aquamarine;
}
.footer {
background-color: blanchedalmond;
}
</style>
- Use on page:
<template>
<div>
<div>main</div>
</div>
</template>
<script>
export default {
layout: 'DefaultLayout'
}
</script>
Screenshot below: