-
Notifications
You must be signed in to change notification settings - Fork 370
/
mpx-checkbox.vue
51 lines (46 loc) · 1.01 KB
/
mpx-checkbox.vue
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
<script>
import getInnerListeners from '@mpxjs/webpack-plugin/lib/runtime/components/web/getInnerListeners'
export default {
name: 'mpx-checkbox',
props: {
value: {
type: String,
default: ''
},
disabled: Boolean,
checked: Boolean,
color: {
type: String,
default: '#09BB07'
}
},
render (createElement) {
const mergeAfter = {
listeners: {
change: () => {
if (this.group) {
this.group.notifyChange()
}
}
},
force: true
}
const attrs = {
value: this.value,
type: 'checkbox',
checked: this.checked,
disabled: this.disabled
}
const data = {
class: 'mpx-checkbox',
on: getInnerListeners(this, { mergeAfter }),
attrs
}
return createElement('input', data, this.$slots.default)
}
}
</script>
<style lang="stylus">
.mpx-checkbox
margin 3px 3px 3px 4px
</style>