Skip to content

Commit 0e487e3

Browse files
committed
05_08_f
1 parent cb6aac2 commit 0e487e3

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

vuejs3-linkedin-project/src/components/Products.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
<h3>Pizza {{ type }}</h3>
66
<p>Prix : {{ price }} €</p>
77
<p>{{ ingredients }}</p>
8-
<router-link
9-
:to="{ name: 'product-details', params: { name: 'un-parametre' } }"
10-
>
8+
<router-link :to="{ name: 'product-details', params: { name: type } }">
119
Commander >>
1210
</router-link>
1311
</div>

vuejs3-linkedin-project/src/router/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Contact from "../views/Contact.vue";
44
import NotFound from "../views/NotFound.vue";
55
import ProductDetails from "../views/ProductDetails.vue";
66

7+
78
const routes = [
89
{
910
path: "/",
@@ -20,6 +21,7 @@ const routes = [
2021
path: '/products/:name',
2122
name: "product-details",
2223
component: ProductDetails,
24+
props: true
2325
},
2426
{
2527
path: '/:catchAll(.*)',

vuejs3-linkedin-project/src/views/ProductDetails.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
<!-- Description du produit -->
4747
<div class="product-description">
4848
<h1>
49-
{{ $route.params.name }}
49+
{{ title }}
5050
<img class="img-best-seller" src="../assets/images/best-seller.png" />
5151
</h1>
5252
<p v-show="notAvailable">Momentanément indisponible</p>
@@ -105,6 +105,7 @@
105105

106106
<script>
107107
export default {
108+
props: ["name"],
108109
data() {
109110
return {
110111
product: "Pizza",

0 commit comments

Comments
 (0)