Router test OK

This commit is contained in:
Jérémy Munsch 2024-01-08 16:14:58 +01:00
parent 706bd07f0b
commit eaca6cedd2
No known key found for this signature in database
GPG key ID: 18361AF3BFEC0FEC
4 changed files with 84 additions and 2 deletions

11
app.vue
View file

@ -1,6 +1,13 @@
<template>
<div class="app-component">
<RangesShow :data-json="data" @selected="itemClicked($event.item)" />
<NuxtLink to="/">
Home
</NuxtLink>
<NuxtLink to="/ranges">
Ranges
</NuxtLink>
<NuxtPage :page-key="(route: RouteLocation) => route.fullPath" />
<!-- <RangesShow :data-json="data" @selected="itemClicked($event.item)" />
<ProductModal
v-if="selectedItem"
:id="modalId"
@ -8,7 +15,7 @@
:settings="data.modalSettings"
@saved="SaveContact"
/>
<AdministrativeModal :id="adminModalId" :contacts="contacts" />
<AdministrativeModal :id="adminModalId" :contacts="contacts" /> -->
</div>
</template>

17
pages/index.vue Normal file
View file

@ -0,0 +1,17 @@
<template>
<div class="page-home">
<h1>Home</h1>
</div>
</template>
<script lang="ts">
import { defineComponent } from "vue";
export default defineComponent({
name: "HomePage",
props: {
},
methods: {
}
});
</script>

29
pages/ranges/[slug].vue Normal file
View file

@ -0,0 +1,29 @@
<template>
<div class="page-ranges-index">
<h1>Range {{ router.params.slug }}</h1>
</div>
</template>
<script lang="ts">
import { defineComponent } from "vue";
import { useRoute, type RouteLocationNormalizedLoaded } from "vue-router";
export default defineComponent({
name: "RangesIndex",
props: {
},
data(): {
router: RouteLocationNormalizedLoaded
} {
return {
router: useRoute()
};
},
mounted() {
const route = useRoute();
console.log(route);
},
methods: {
}
});
</script>

29
pages/ranges/index.vue Normal file
View file

@ -0,0 +1,29 @@
<template>
<div class="page-ranges-index">
<h1>RangesIndex</h1>
<NuxtLink to="/ranges/charcuterie">
charcuterie
</NuxtLink>
<br>
<NuxtLink to="/ranges/panés">
panés
</NuxtLink>
</div>
</template>
<script lang="ts">
import { defineComponent } from "vue";
import { useRoute } from "vue-router";
export default defineComponent({
name: "RangesIndex",
props: {
},
mounted() {
const route = useRoute();
console.log(route);
},
methods: {
}
});
</script>