forked from AStaroverov/vue-toast
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
96 lines (88 loc) · 2.08 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Vue toast</title>
<link rel="stylesheet" href="./dist/vue-toast.css" charset="utf-8">
</head>
<body>
<div id='app'>
<h3>Options of component.</h3>
<br>
<label>
<input type="text" v-model="maxToasts">
maxToasts
</label>
<br>
<label>
<input type="text" v-model="position">
position
</label>
<hr>
<h3>Options of toast.</h3>
<label>
<input type="text" v-model="theme">
theme
</label>
<br>
<label>
<input type="text" v-model="timeLife">
timeLife
</label>
<br>
<label>
<input type="checkbox" v-model="closeBtn">
closeBtn
</label>
<hr>
<button type="button" name="button" @click="showTime">SHOW TIME</button>
<button type="button" name="button" @click="closeAll">Close all</button>
<vue-toast ref='toast'></vue-toast>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.3.0/vue.js" charset="utf-8"></script>
<script src="./dist/vue-toast.js"></script>
<script>
const VueToast = window.vueToasts ? window.vueToasts.default || window.vueToasts : window.vueToasts
new Vue({
el: '#app',
data: {
maxToasts: 6,
position: 'bottom right',
theme: 'error',
timeLife: 3000,
closeBtn: true,
},
watch: {
'delayOfJumps': 'resetOptions',
'maxToasts': 'resetOptions',
'position': 'resetOptions'
},
mounted() {
this.resetOptions()
},
methods: {
resetOptions() {
this.$refs.toast.setOptions({
delayOfJumps: this.delayOfJumps,
maxToasts: this.maxToasts,
position: this.position
})
},
showTime() {
this.$refs.toast.showToast(new Date, {
theme: this.theme,
timeLife: this.timeLife,
closeBtn: this.closeBtn
})
},
closeAll() {
this.$refs.toast.closeAll()
}
},
components: {
VueToast
}
})
</script>
</body>
</html>