generated from Hebilicious/nuxt-module-template
-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: dynamic parameters route loaders (#45)
- Loading branch information
1 parent
075420a
commit 7a26b49
Showing
9 changed files
with
73 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<script setup lang="ts"> | ||
const pages = [ | ||
{ name: "Home", path: "/" }, | ||
{ name: "Cool", path: "/cool" }, | ||
{ name: "Mangas", path: "/mangas" }, | ||
{ name: "Mangas:[id]", path: "/mangas/naruto" }, | ||
{ name: "Books", path: "/books" }, | ||
{ name: "Books:[bookId]", path: "/books/5" }, | ||
{ name: "Todos", path: "/todos" }, | ||
{ name: "Login", path: "/login" }, | ||
{ name: "Advanced Login", path: "/advanced-login" }, | ||
{ name: "Nested:Test", path: "/nested/test" }, | ||
{ name: "Nested:NestedAgain:Books", path: "/nested/nested-again/books" }, | ||
{ name: "Nested:NestedAgain:Stuff", path: "/nested/nested-again/stuff" } | ||
] | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<h1>Advanced playground</h1> | ||
<nav> | ||
<template v-for="page of pages" :key="page.path"> | ||
<NuxtLink :to="page.path"> | ||
{{ page.name }} | ||
</NuxtLink> | ||
</template> | ||
</nav> | ||
<hr> | ||
<slot /> | ||
</div> | ||
</template> | ||
|
||
<style> | ||
nav { | ||
display: flex; | ||
gap: 1rem; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<script setup lang="ts"> | ||
const route = useRoute() | ||
const { result } = await useLoader("books") | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<h1>Main Books</h1> | ||
{{ route.params }} | ||
{{ result }} | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<script setup lang="ts"> | ||
const { result } = await useLoader("mangas") | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<h1>Mangas Main</h1> | ||
{{ result }} | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<template> | ||
<form method="POST"> | ||
<input name="test" type="text" value="Hello World"> | ||
<button>This button will submit a form with a POST method and return JSON directly because progressive enhancement isn't enabled.</button> | ||
</form> | ||
</template> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters