L2 Starting code

This commit is contained in:
Adam Jahr 2020-05-22 00:13:15 -04:00
parent 142346579f
commit 8dd2042e95
2 changed files with 3 additions and 33 deletions

View File

@ -10,28 +10,10 @@
</head> </head>
<body> <body>
<div id="app"> <div id="app">
<div class="nav-bar"></div> <h1>Product goes here</h1>
<div class="cart">
<p>Cart({{ cart.length }})</p>
</div>
<product-display
:premium="premium"
@add-to-cart="updateCart"
></product-display>
</div> </div>
<!-- Import App --> <!-- Import JS -->
<script src="./main.js"></script> <script src="./main.js"></script>
<!-- Import Components -->
<script src="./components/ProductDisplay.js"></script>
<script src="./components/ReviewForm.js"></script>
<script src="./components/ReviewList.js"></script>
<!-- Mount App -->
<script>
app.mount('#app')
</script>
</body> </body>
</html> </html>

14
main.js
View File

@ -1,13 +1 @@
const app = Vue.createApp({ const product = "Socks"
data() {
return {
premium: true,
cart: []
}
},
methods: {
updateCart(id) {
this.cart.push(id)
}
}
})