forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQToggle.js
More file actions
58 lines (48 loc) · 1.09 KB
/
QToggle.js
File metadata and controls
58 lines (48 loc) · 1.09 KB
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
import Vue from 'vue'
import QIcon from '../icon/QIcon.js'
import CheckboxMixin from '../../mixins/checkbox.js'
export default Vue.extend({
name: 'QToggle',
mixins: [ CheckboxMixin ],
props: {
icon: String,
iconColor: String
},
computed: {
computedIcon () {
return (
this.isTrue === true
? this.checkedIcon
: (this.isIndeterminate === true ? this.indeterminateIcon : this.uncheckedIcon)
) || this.icon
},
computedIconColor () {
if (this.isTrue === true) {
return this.iconColor
}
}
},
methods: {
__getInner (h) {
return [
h('div', { staticClass: 'q-toggle__track' }),
h('div', {
staticClass: 'q-toggle__thumb absolute flex flex-center no-wrap'
}, this.computedIcon !== void 0
? [
h(QIcon, {
props: {
name: this.computedIcon,
color: this.computedIconColor
}
})
]
: void 0
)
]
}
},
created () {
this.type = 'toggle'
}
})