diff --git a/index.html b/index.html index a481a22..af8999b 100644 --- a/index.html +++ b/index.html @@ -15,19 +15,38 @@
- -

Vue.js Poster Shop

+ +

BJ's Vue.js Shop

+
-

Products go here.

-
+
+
+

{{ product.title }}

+ +
+

Shopping Cart

-
- Total: $0.00 +
    +
  • +
    {{ item.title }}
    + {{ item.price | currency }} x {{ item.qty}} + + +
  • +
+
+
Total: {{ total | currency }}
+
+
+ No items in the cart.
@@ -35,6 +54,7 @@

Shopping Cart

+ diff --git a/package-lock.json b/package-lock.json index e6777cf..bf89f6b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3894,6 +3894,11 @@ "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" }, + "vue": { + "version": "2.5.17", + "resolved": "https://registry.npmjs.org/vue/-/vue-2.5.17.tgz", + "integrity": "sha512-mFbcWoDIJi0w0Za4emyLiW72Jae0yjANHbCVquMKijcavBGypqlF7zHRgMa5k4sesdv7hv2rB4JPdZfR+TPfhQ==" + }, "which": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", diff --git a/package.json b/package.json index c6671fe..e419c8f 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,8 @@ "axios": "~0.18.0", "body-parser": "~1.18.3", "dotenv": "~6.0.0", - "express": "~4.16.4" + "express": "~4.16.4", + "vue": "^2.5.17" }, "devDependencies": { "eslint": "~5.5.0", diff --git a/public/book1.jpg b/public/book1.jpg new file mode 100644 index 0000000..d82c6f8 Binary files /dev/null and b/public/book1.jpg differ diff --git a/public/knight1.jpg b/public/knight1.jpg new file mode 100644 index 0000000..8d25e6c Binary files /dev/null and b/public/knight1.jpg differ diff --git a/public/script.js b/public/script.js index 4c1ad42..3ce9418 100644 --- a/public/script.js +++ b/public/script.js @@ -1 +1,58 @@ -console.log("It works!"); + +new Vue({ + el: "#app", + data: { + total: 0, + products: [ + { title: "Product 1", id: 1, price: 9.99}, + { title: "Product 2", id: 2, price: 9.99}, + { title: "Product 3", id: 3, price: 9.99} + ], + cart: [], + search: "" + }, + methods: { + addToCart: function(product) { + this.total += product.price; + var found = false; /* under this condition the cart is able to increment product by adding 1 so only executes when false bool*/ + for (var i=0;i img { display: block; - height: 50px; + height: 110px; } .title > h1 {