forked from vuejsdevelopers/poster-shop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
90 lines (83 loc) · 3.67 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<!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>Vue.js Poster 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" v-cloak>
<div id="loading">Loading...</div>
<div class="header">
<div class="container">
<div class="title">
<img src="public/logo.png">
<h1>Vue.js Poster Shop</h1>
</div>
<form class="search-bar" v-on:submit.prevent="onSubmit">
<input type="text" placeholder="Search for posters" 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 {{ results.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 id="product-list-bottom">
<div v-if="products.length === results.length && results.length > 0">No More items.</div>
</div>
</div>
<div class="cart">
<h2>Shopping Cart</h2>
<div v-if="cart.length === 0">
<div class="empty-cart">
No items in the cart.
</div>
</div>
<transition-group tag="ul" name="fade">
<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>
</transition-group>
<transition name="fade">
<div v-if="cart.length">
<div class="cart-total">Total: {{ total | currency }}</div>
</div>
</transition>
</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="/node_modules/scrollmonitor/scrollMonitor.js"></script>
<script type="text/javascript" src="public/script.js"></script>
</body>
</html>