-
Notifications
You must be signed in to change notification settings - Fork 9
/
index.html
297 lines (277 loc) · 12 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>vuejs-countdown-timer</title>
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="https://unpkg.com/highlightjs@9.10.0/styles/github.css">
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script src="dist/vuejs-countdown-timer.min.js"></script>
<style>
html, body {
height: 100%;
}
i {
font-style: normal;
padding-left: 3px;
}
.gradient-background {
background: linear-gradient(230deg, #a24bcf, #4b79cf, #4bc5cf);
background-size: 300% 300%;
-webkit-animation: AnimationName 15s ease infinite;
-moz-animation: AnimationName 15s ease infinite;
animation: AnimationName 15s ease infinite;
}
@-webkit-keyframes AnimationName {
0%{background-position:0% 50%}
50%{background-position:100% 50%}
100%{background-position:0% 50%}
}
@-moz-keyframes AnimationName {
0%{background-position:0% 50%}
50%{background-position:100% 50%}
100%{background-position:0% 50%}
}
@keyframes AnimationName {
0%{background-position:0% 50%}
50%{background-position:100% 50%}
100%{background-position:0% 50%}
}
</style>
</head>
<body>
<div id="app">
<nav class="navbar navbar-light bg-light">
<div class="container">
<a class="navbar-brand" href="#">
Vuejs Countdown Timer
</a>
<ul class="navbar-nav d-inline-flex justify-content-end flex-row">
<li class="nav-item mr-3">
<a class="nav-link" href="https://github.com/TriDiamond/vuejs-countdown-timer/blob/master/README.md">Full Document</a>
</li>
<li class="nav-item mr-3">
<a class="nav-link" href="https://github.com/TriDiamond/vuejs-countdown-timer/blob/master/CHANGELOG.md">Changelog</a>
</li>
<li class="nav-item mr-3">
<a class="nav-link" href="https://github.com/TriDiamond/vuejs-countdown-timer">Github</a>
</li>
</ul>
</div>
</nav>
<div class="jumbotron jumbotron-fluid gradient-background text-white">
<div class="container">
<h5 class="display-4">vuejs-countdown-timer</h5>
<p class="lead">Vuejs event coutdown timer! Supports event labels, countdown till start and countdown till end!</p>
</div>
</div>
<div class="container">
<div class="row mb-5">
<div class="col">
<a href="https://circleci.com/gh/TriDiamond/vuejs-countdown-timer/tree/master">
<img src="https://img.shields.io/circleci/project/github/TriDiamond/vuejs-countdown-timer.svg" alt="Build Status">
</a>
<a href="https://github.com/TriDiamond/vuejs-countdown-timer/stargazers">
<img src="https://img.shields.io/github/stars/TriDiamond/vuejs-countdown-timer.svg" alt="Github starts">
</a>
<a>
<img src="https://img.shields.io/github/license/TriDiamond/vuejs-countdown-timer.svg" alt="License">
</a>
<a href="https://www.npmjs.com/package/vuejs-countdown-timer">
<img src="https://img.shields.io/npm/dt/vuejs-countdown-timer.svg" alt="Npm downloads">
</a>
<a>
<img src="https://img.shields.io/npm/v/vuejs-countdown-timer.svg" alt="Npm version">
</a>
</div>
</div>
<div class="row mb-5">
<div class="col">
<h4>Default template<small></small></h4>
<hr>
<vue-countdown-timer
@start_callback="startCallBack('event started')"
@end_callback="endCallBack('event ended')"
:interval="100"
:start-time="startTime1"
:end-time="endTime1"
:start-label="'Till starts'"
:end-label="'Till ends'"
:end-text="'Ended'"
:day-txt="'days'"
:hour-txt="'hours'"
:minutes-txt="'minutes'"
:seconds-txt="'seconds'">
</vue-countdown-timer>
</div>
</div>
<div class="row mb-5">
<div class="col">
<h4>Custom template <small></small></h4>
<hr>
<vue-countdown-timer
@start_callback="startCallBack('event started')"
@end_callback="endCallBack('event ended')"
:interval="100"
:start-time="startTime1"
:end-time="endTime1"
:start-label="'Till starts'"
:end-label="'Till ends'"
:end-text="'Ended'"
:day-txt="'days'"
:hour-txt="'hours'"
:minutes-txt="'minutes'"
:seconds-txt="'seconds'">
<template slot="start-label" slot-scope="scope">
<span style="color: red" v-if="scope.props.startLabel !== '' && scope.props.tips && scope.props.labelPosition === 'begin'">{{scope.props.startLabel}}:</span>
<span style="color: blue" v-if="scope.props.endLabel !== '' && !scope.props.tips && scope.props.labelPosition === 'begin'">{{scope.props.endLabel}}:</span>
</template>
<template slot="countdown" slot-scope="scope">
<span class="badge badge-secondary">{{scope.props.days}}</span><i>{{scope.props.dayTxt}}</i>
<span class="badge badge-secondary">{{scope.props.hours}}</span><i>{{scope.props.hourTxt}}</i>
<span class="badge badge-secondary">{{scope.props.minutes}}</span><i>{{scope.props.minutesTxt}}</i>
<span class="badge badge-secondary">{{scope.props.seconds}}</span><i>{{scope.props.secondsTxt}}</i>
</template>
<template slot="end-label" slot-scope="scope">
<span style="color: red" v-if="scope.props.startLabel !== '' && scope.props.tips && scope.props.labelPosition === 'end'">{{scope.props.startLabel}}:</span>
<span style="color: blue" v-if="scope.props.endLabel !== '' && !scope.props.tips && scope.props.labelPosition === 'end'">{{scope.props.endLabel}}:</span>
</template>
<template slot="end-text" slot-scope="scope">
<span style="color: green">{{ scope.props.endText}}</span>
</template>
</vue-countdown-timer>
</div>
</div>
<div class="row mb-5">
<div class="col">
<h4>Hide zeros (隐藏00) <small><span class="badge badge-pill badge-warning">New</span></small></h4>
<hr>
<vue-countdown-timer
@start_callback="startCallBack('event start')"
@end_callback="endCallBack('event ended')"
:interval="100"
:start-time="startTime1"
:end-time="endTime1"
:start-label="'Till starts'"
:end-label="'Till ends'"
:end-text="'Ended'"
:day-txt="'days'"
:hour-txt="'hours'"
:minutes-txt="'minutes'"
:seconds-txt="'seconds'"
:show-zero="false">
</vue-countdown-timer>
</div>
</div>
<div class="row mb-5">
<div class="col">
<h4>Hide certain units (隐藏特定单位) <small><span class="badge badge-pill badge-warning">New</span></small></h4>
<hr>
<vue-countdown-timer
@start_callback="startCallBack('event start')"
@end_callback="endCallBack('event ended')"
:interval="100"
:start-time="startTime3"
:end-time="endTime3"
:start-label="'Till starts'"
:end-label="'Till ends'"
:end-text="'Ended'"
:day-txt="null"
:hour-txt="'hours'"
:minutes-txt="null"
:seconds-txt="'seconds'"
:show-zero="true">
</vue-countdown-timer>
</div>
</div>
<div class="row mb-5">
<div class="col">
<h4>默认模板<small></small></h4>
<hr>
<vue-countdown-timer
@start_callback="startCallBack('活动开始')"
@end_callback="endCallBack('活动结束')"
:interval="100"
:start-time="startTime2"
:end-time="endTime2"
:start-label="'距离开始'"
:end-label="'距离结束'"
:end-text="'已结束'"
:day-txt="'天'"
:hour-txt="'小时'"
:minutes-txt="'分钟'"
:seconds-txt="'秒'">
</vue-countdown-timer>
</div>
</div>
<div class="row mb-5">
<div class="col">
<h4>自定义模板<small></small></h4>
<hr>
<vue-countdown-timer
@start_callback="startCallBack('活动开始')"
@end_callback="endCallBack('活动结束')"
:interval="100"
:start-time="startTime2"
:end-time="endTime2"
:start-label="'距离开始'"
:end-label="'距离结束'"
:end-text="'已结束'"
:day-txt="'天'"
:hour-txt="'小时'"
:minutes-txt="'分钟'"
:seconds-txt="'秒'">
<template slot="start-label" slot-scope="scope">
<span style="color: red" v-if="scope.props.startLabel !== '' && scope.props.tips && scope.props.labelPosition === 'begin'">{{scope.props.startLabel}}:</span>
<span style="color: blue" v-if="scope.props.endLabel !== '' && !scope.props.tips && scope.props.labelPosition === 'begin'">{{scope.props.endLabel}}:</span>
</template>
<template slot="countdown" slot-scope="scope">
<span class="badge badge-secondary">{{scope.props.days}}</span><i>{{scope.props.dayTxt}}</i>
<span class="badge badge-secondary">{{scope.props.hours}}</span><i>{{scope.props.hourTxt}}</i>
<span class="badge badge-secondary">{{scope.props.minutes}}</span><i>{{scope.props.minutesTxt}}</i>
<span class="badge badge-secondary">{{scope.props.seconds}}</span><i>{{scope.props.secondsTxt}}</i>
</template>
<template slot="end-label" slot-scope="scope">
<span style="color: red" v-if="scope.props.startLabel !== '' && scope.props.tips && scope.props.labelPosition === 'end'">{{scope.props.startLabel}}:</span>
<span style="color: blue" v-if="scope.props.endLabel !== '' && !scope.props.tips && scope.props.labelPosition === 'end'">{{scope.props.endLabel}}:</span>
</template>
<template slot="end-text" slot-scope="scope">
<span style="color: green">{{ scope.props.endText}}</span>
</template>
</vue-countdown-timer>
</div>
</div>
</div>
</div>
<script>
var app = new Vue({
el: '#app',
data() {
const now = new Date()
return {
startTime1: new Date(now.getTime() + (1000 * 10)),
endTime1: new Date(now.getTime() + (1000 * 20)),
startTime2: new Date(now.getTime() + (1000 * 30)),
endTime2: new Date(now.getTime() + (1000 * 40)),
startTime3: new Date(now.getTime() + (1000 * 60 * 60 * 24 * 2)),
endTime3: new Date(now.getTime() + (1000 * 60 * 60 * 24 * 2) + (1000 * 10))
}
},
methods: {
startCallBack: function (msg) {
console.log(msg)
},
endCallBack: function (msg) {
console.log(msg)
}
}
})
Vue.use(VueCountdownTimer)
</script>
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdn.bootcss.com/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://cdn.bootcss.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script src="https://unpkg.com/highlightjs@9.10.0/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
</body>
</html>