-
Notifications
You must be signed in to change notification settings - Fork 354
/
Copy pathCheckboxInput.vue
58 lines (50 loc) · 1.06 KB
/
CheckboxInput.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
52
53
54
55
56
57
58
<template>
<input-wrapper v-bind="inputWrapperProps">
<template #label>
<span />
</template>
<v-checkbox
:id="id ? id : name"
v-model="compVal"
:disabled="disabled ? true : null"
:name="name"
:color="color"
>
<slot name="label">
{{ label }}
<span
v-if="required"
class="text-red-500 required-dot"
>*</span>
</slot>
</v-checkbox>
<template #help>
<slot name="help" />
</template>
<template #error>
<slot name="error" />
</template>
</input-wrapper>
</template>
<script>
import { inputProps, useFormInput } from "./useFormInput.js"
import VCheckbox from "./components/VCheckbox.vue"
import InputWrapper from "./components/InputWrapper.vue"
export default {
name: "CheckboxInput",
components: { InputWrapper, VCheckbox },
props: {
...inputProps,
},
setup(props, context) {
return {
...useFormInput(props, context),
}
},
mounted() {
if (!this.compVal) {
this.compVal = false
}
},
}
</script>