diff --git a/assets/styles.css b/assets/styles.css index c52316317..db783a74d 100644 --- a/assets/styles.css +++ b/assets/styles.css @@ -25,7 +25,7 @@ body { margin: 25px 100px; float: right; border: 1px solid #d8d8d8; - padding: 10px 30px; + padding: 30px 30px; background-color: white; -webkit-box-shadow: 0px 2px 15px -12px rgba(0, 0, 0, 0.57); -moz-box-shadow: 0px 2px 15px -12px rgba(0, 0, 0, 0.57); diff --git a/index.html b/index.html index 56c112638..fbb4832e5 100644 --- a/index.html +++ b/index.html @@ -6,14 +6,45 @@ - +
-

Product goes here

+ + +
Cart({{ cart }})
+ +
+
+
+ +
+
+

{{ title }}

+

In Stock

+

Out of Stock

+
    +
  • {{ detail }}
  • +
+ +
+

{{ onSale }}

+ +
+
+
- + + + diff --git a/main.js b/main.js index aedc73d86..4f09c2bd1 100644 --- a/main.js +++ b/main.js @@ -1 +1,40 @@ -const product = 'Socks' +const app = Vue.createApp({ + data() { + return { + cart:0, + brand: 'Vue Mastery', + product: 'Socks', + selectedVariant: 0, + details: ['50% cotton', '30% wool', '20% polyester'], + variants: [ + { id: 2234, color: 'green', image: './assets/images/socks_green.jpg', quantity: 50, onSale: true }, + { id: 2235, color: 'blue', image: './assets/images/socks_blue.jpg', quantity: 0, onSale: false }, + ] + } + }, + methods: { + addToCart() { + this.cart += 1 + }, + updateVariant(index) { + this.selectedVariant = index + } + }, + computed: { + title() { + return this.brand + ' ' + this.product + }, + + image() { + return this.variants[this.selectedVariant].image + }, + + inStock() { + return this.variants[this.selectedVariant].quantity + }, + + ifSale() { + return this.brand + ' ' + this.product + ' is on sale' + } + } +}) \ No newline at end of file