forked from vuejsdevelopers/poster-shop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
75 lines (74 loc) · 3.18 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!doctype html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml" xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta name="referrer" content="never" />
<title>DrShopify's #1-Stop Shop</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/x-icon" href="/public/favicon.ico">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,400italic,600,700,800" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Baloo+Bhaina" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="/public/style.css">
</head>
<body>
<div id="app">
<div class="header">
<div class="container">
<div class="title">
<img src="public/logo.png">
<h1>DrShopify's #1-Stop Shop</h1>
</div>
<form class="search-bar" v-on:submit.prevent="onSubmit">
<input type="text" placeholder="Search for products" required v-model="search">
<input type="submit" value="Search" class="btn">
</form>
<p>Try search terms <em>cat, dog, flower</em></p>
</div>
</div>
<div class="main container">
<div class="products">
<div v-if="loading">
Loading...
</div>
<div class="search-results" v-else>
Found {{products.length}} results for search term <em> {{ lastSearch }}</em>
</div>
<div v-for="product in products" class="product" v-bind:key="product.id">
<div>
<div class="product-image">
<img v-bind:src="product.thumb">
</div>
</div>
<div>
<h4 class="product-title"> {{ product.title }} </h4>
<p class="product-price"><strong>{{ product.price | currency }}</strong></p>
<button v-on:click="addToCart(product)" class="add-to-cart btn">Add to Cart</button>
</div>
</div>
</div>
<div class="cart">
<h2>Shopping Cart</h2>
<ul>
<li v-for="item in cart" v-bind:key="item.id" class="cart-item">
<div class="item-title"> {{ item.title }}</div>
<span class="item-qty">{{ item.price | currency }} x {{ item.qty }}</span>
<button class="btn" v-on:click="inc(item)">+</button>
<button class="btn" v-on:click="dec(item)">-</button>
</li>
</ul>
<div v-if="cart.length">
<div class="cart-total">Total: {{ total | currency }} </div>
</div>
<div v-else class="empty-cart">
No items in the cart.
</div>
</div>
</div>
</div>
<!-- Scripts -->
<script src="/reload/reload.js"></script>
<script type="text/javascript" src="node_modules/vue/dist/vue.js"></script>
<script type="text/javascript" src="node_modules/vue-resource/dist/vue-resource.js"></script>
<script type="text/javascript" src="public/script.js"></script>
</body>
</html>