feat: introduce layouts (#28)
This commit is contained in:
1 parent
7bfa84d907
commit
b1eaea501a
8 files changed
+68
-3
No files matched your search
@@ -31,6 +31,8 @@
|
|||||||
|
|
||||||
- 🍍 [State Management via Pinia](https://pinia.esm.dev/)
|
- 🍍 [State Management via Pinia](https://pinia.esm.dev/)
|
||||||
|
|
||||||
|
- 📑 [Layout system](./layouts)
|
||||||
|
|
||||||
- 📥 APIs auto importing - for Composition API, VueUse and custom composables.
|
- 📥 APIs auto importing - for Composition API, VueUse and custom composables.
|
||||||
|
|
||||||
- 🏎 Zero-config cloud functions and deploy
|
- 🏎 Zero-config cloud functions and deploy
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<main class="py-20 px-10 text-center">
|
<NuxtLayout>
|
||||||
<NuxtPage />
|
<NuxtPage />
|
||||||
<Footer />
|
</NuxtLayout>
|
||||||
</main>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
const router = useRouter()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<main p="x4 y10" text="center teal-700 dark:gray-200">
|
||||||
|
<div text-4xl>
|
||||||
|
<div i-carbon-warning inline-block />
|
||||||
|
</div>
|
||||||
|
<slot />
|
||||||
|
<div>
|
||||||
|
<button btn text-sm m="3 t8" @click="router.back()">
|
||||||
|
Back
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<Footer />
|
||||||
|
</main>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
## Layouts
|
||||||
|
|
||||||
|
Vue components in this dir are used as layouts.
|
||||||
|
|
||||||
|
By default, `default.vue` will be used unless an alternative is specified in the route meta.
|
||||||
|
|
||||||
|
```html
|
||||||
|
<script setup lang="ts">
|
||||||
|
definePageMeta({
|
||||||
|
layout: 'home',
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
```
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<template>
|
||||||
|
<main class="py-20 px-10 text-center">
|
||||||
|
<slot />
|
||||||
|
<Footer />
|
||||||
|
<div class="mt-5 mx-auto text-center opacity-25 text-sm">
|
||||||
|
[Default Layout]
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<template>
|
||||||
|
<main class="py-20 px-10 text-center">
|
||||||
|
<slot />
|
||||||
|
<Footer />
|
||||||
|
<div class="mt-5 mx-auto text-center opacity-25 text-sm">
|
||||||
|
[Home Layout]
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
definePageMeta({
|
||||||
|
layout: '404',
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
Not Found
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -6,6 +6,10 @@ const name = route.params.id
|
|||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
user.setNewName(route.params.id as string)
|
user.setNewName(route.params.id as string)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
definePageMeta({
|
||||||
|
layout: 'home',
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
Reference in new issue
Block a user