-
Notifications
You must be signed in to change notification settings - Fork 3
/
demo.html
90 lines (71 loc) · 3.01 KB
/
demo.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>
<head>
<title>spin-select demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui"/>
<script src="../webcomponentsjs/webcomponents.min.js"></script>
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="spin-select.html">
</head>
<body>
<polymer-element name="spin-select-demo" layout vertical>
<template>
<style>
:host {
font-family: sans-serif;
padding: 20px;
}
:host > div, :host > label {
padding: 5px;
text-align: center;
}
hr {
width: 100%;
margin: 20px 0;
}
</style>
<spin-select value="{{ value }}" repeat="{{ repeat }}"
selectedIndex="{{ selectedIndex }}"
selectedOption="{{ selectedOption }}"
on-select="{{ selectHandler }}">
<option label="January" value="1"></option>
<option label="Feburary" value="2"></option>
<option label="March" value="3"></option>
<option label="April" value="4"></option>
<option label="May" value="5"></option>
<option label="June" value="6"></option>
<option label="July" value="7"></option>
<option label="August" value="8"></option>
<option label="September" value="9"></option>
<option label="October" value="10"></option>
<option label="November" value="11"></option>
<option label="Dezember" value="12"></option>
</spin-select>
<hr>
<label>Repeat options
<input type="checkbox" checked="{{ repeat }}" />
</label>
<div>index: {{ selectedIndex }}</div>
<div>value: {{ value }}</div>
<div>label: {{ selectedOption.label }}</div>
<hr>
<spin-select options="{{ dates }}"><spin-select>
</template>
<script>
Polymer({
repeat: true,
selectHandler: console.log.bind(console, 'select'),
dates: function(i) {
var date = new Date();
date.setDate(date.getDate() + i);
return {
value: date,
label: date.toLocaleDateString()
};
}
});
</script>
</polymer-element>
<spin-select-demo fit></spin-select-demo>
</body>
</html>