File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 22 <div id =" products" class =" row list-group" >
33 <div v-for =" product in products" class =" item col-xs-4" >
44 <div class =" thumbnail" >
5- <img class =" group list-group-image" src =" http://placehold.it/400x250/000/fff" >
5+ <img @click = " clickedImage(product) " class =" group list-group-image" src =" http://placehold.it/400x250/000/fff" >
66 <div class =" caption" >
77 <router-link
88 :to =" { name: 'viewProduct', params: { productId: product.id } }"
4848 product: product,
4949 quantity: quantity
5050 });
51+ },
52+ clickedImage (product ) {
53+ this .$router .push ({
54+ name: ' viewProduct' ,
55+ params: {
56+ productId: product .id
57+ }
58+ });
5159 }
5260 }
5361 }
Original file line number Diff line number Diff line change 11<template >
22 <div >
3+ <button class =" btn btn-primary" @click =" goBack" >« ; Back</button >
4+
35 <h1 >{{ product.name }}</h1 >
46 <p ><strong >ID:</strong > {{ product.id }}</p >
57 <p ><strong >Price:</strong > {{ product.price | currency }}</p >
5355 });
5456
5557 return match;
58+ },
59+ goBack () {
60+ this .$router .push (' /' );
5661 }
5762 },
5863 computed: {
You can’t perform that action at this time.
0 commit comments