File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 66
77 <div class =" product-info" >
88 <h1 >
9- {{ product.name }}
9+ {{ title }}
1010 <!-- eslint-disable-next-line vue/no-unused-vars -->
1111 <i v-for =" i in averageReviewScore" class =" fa fa-star" :key =" i" ></i >
1212 </h1 >
@@ -56,13 +56,14 @@ export default class Product extends Vue {
5656 product = {
5757 name: " Vue Socks" ,
5858 brand: " Vue" ,
59+ price: 5 ,
5960 variants: [
6061 {id: 1 , color: " green" },
6162 {id: 2 , color: " blue" }
6263 ],
6364 inventory: 3 ,
6465 reviews: []
65- }
66+ };
6667
6768 selectedVariantIndex = 0 ;
6869
@@ -77,6 +78,10 @@ export default class Product extends Vue {
7778 return Math .round (this .product .reviews .reduce ((a , c ) => a + c , 0 ) / this .product .reviews .length );
7879 }
7980
81+ get title() {
82+ return ` ${this .product .name } ($${this .product .price }) ` ;
83+ }
84+
8085 addToCart() {
8186 this .product .inventory -- ;
8287 const selectedVariant = this .product .variants [this .selectedVariantIndex ];
You can’t perform that action at this time.
0 commit comments