Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

L7 personal #136

Open
wants to merge 5 commits into
base: L7-start
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 0 additions & 102 deletions components/ProductDisplay.js

This file was deleted.

52 changes: 0 additions & 52 deletions components/ReviewForm.js

This file was deleted.

22 changes: 0 additions & 22 deletions components/ReviewList.js

This file was deleted.

5 changes: 3 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<!-- Import Styles -->
<link rel="stylesheet" href="./assets/styles.css" />
<!-- Import Vue.js -->
<script src="https://unpkg.com/[email protected].0-beta.12/dist/vue.global.js"></script>
<script src="https://unpkg.com/[email protected].11/dist/vue.global.js"></script>
</head>
<body>
<div id="app">
Expand All @@ -27,7 +27,8 @@ <h1>{{ product }}</h1>
<li v-for="detail in details">{{ detail }}</li>
</ul>
<div v-for="variant in variants" :key="variant.id" @mouseover="updateImage(variant.image)">{{ variant.color }}</div>
<button class="button" v-on:click="addToCart">Add to Cart</button>
<button class="button text-center" @click="addToCart">Add to Cart</button>
<button class="button text-center" @click="deleteFromCart">Delete item</button>
</div>
</div>
</div>
Expand Down
9 changes: 7 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,16 @@ const app = Vue.createApp({
}
},
methods: {
addToCart() {
addToCart(){
this.cart += 1
},
updateImage(variantImage) {
updateImage(variantImage){
this.image = variantImage
},
deleteFromCart(){
if (this.cart >0){
this.cart -= 1
}
}
}
})