-
Notifications
You must be signed in to change notification settings - Fork 1
/
demo_with_vmodel.htm
42 lines (38 loc) · 965 Bytes
/
demo_with_vmodel.htm
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
<!--
Copyright (C) 2020 Sebastian Pipping <sebastian@pipping.org>
Licensed under the MIT license
-->
<head>
<!-- development version, includes helpful console warnings -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="vue_cycling_tristate_checkbox_native.js"></script>
</head>
<body>
<div id="app">
<label style="user-select: none">
<tristate-checkbox v-model="tribool_ref"></tristate-checkbox>
{{ triboolToStr(tribool_ref) }}
</label>
</div>
<script>
var app = new Vue({
el: '#app',
data: {
tribool_ref: null // i.e. indeterminate state
},
methods: {
triboolToStr: function(value) {
switch (value) {
case null:
return 'null'
case false:
return 'false'
case true:
default:
return 'true'
}
}
}
})
</script>
</body>