File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 6
6
7
7
<div class =" product-info" >
8
8
<h1 >
9
- {{ product.name }}
9
+ {{ title }}
10
10
<!-- eslint-disable-next-line vue/no-unused-vars -->
11
11
<i v-for =" i in averageReviewScore" class =" fa fa-star" :key =" i" ></i >
12
12
</h1 >
@@ -56,13 +56,14 @@ export default class Product extends Vue {
56
56
product = {
57
57
name: " Vue Socks" ,
58
58
brand: " Vue" ,
59
+ price: 5 ,
59
60
variants: [
60
61
{id: 1 , color: " green" },
61
62
{id: 2 , color: " blue" }
62
63
],
63
64
inventory: 3 ,
64
65
reviews: []
65
- }
66
+ };
66
67
67
68
selectedVariantIndex = 0 ;
68
69
@@ -77,6 +78,10 @@ export default class Product extends Vue {
77
78
return Math .round (this .product .reviews .reduce ((a , c ) => a + c , 0 ) / this .product .reviews .length );
78
79
}
79
80
81
+ get title() {
82
+ return ` ${this .product .name } ($${this .product .price }) ` ;
83
+ }
84
+
80
85
addToCart() {
81
86
this .product .inventory -- ;
82
87
const selectedVariant = this .product .variants [this .selectedVariantIndex ];
You can’t perform that action at this time.
0 commit comments