-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdemo_without_vmodel.htm
41 lines (36 loc) · 975 Bytes
/
demo_without_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
<!--
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 ref="r1" indeterminate></tristate-checkbox>
{{ triboolToStr(($refs.r1 || {}).state) }}
</label>
</div>
<script>
var app = new Vue({
el: '#app',
methods: {
triboolToStr: function(value) {
switch (value) {
case null:
return 'null'
case false:
return 'false'
case true:
default:
return 'true'
}
}
}
})
app.$forceUpdate(); // hacky use of $refs above needs a second render
</script>
</body>