2023-12-09 15:47:03 +01:00
|
|
|
<template>
|
|
|
|
|
<input-wrapper v-bind="inputWrapperProps">
|
|
|
|
|
<template #label>
|
|
|
|
|
<span />
|
|
|
|
|
</template>
|
|
|
|
|
|
2024-04-15 19:39:03 +02:00
|
|
|
<v-checkbox
|
|
|
|
|
:id="id ? id : name"
|
|
|
|
|
v-model="compVal"
|
|
|
|
|
:disabled="disabled ? true : null"
|
|
|
|
|
:name="name"
|
|
|
|
|
>
|
2023-12-09 15:47:03 +01:00
|
|
|
<slot name="label">
|
2024-04-15 19:39:03 +02:00
|
|
|
{{ label }}
|
|
|
|
|
<span
|
|
|
|
|
v-if="required"
|
|
|
|
|
class="text-red-500 required-dot"
|
|
|
|
|
>*</span>
|
2023-12-09 15:47:03 +01:00
|
|
|
</slot>
|
|
|
|
|
</v-checkbox>
|
|
|
|
|
|
|
|
|
|
<template #help>
|
|
|
|
|
<slot name="help" />
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<template #error>
|
|
|
|
|
<slot name="error" />
|
|
|
|
|
</template>
|
|
|
|
|
</input-wrapper>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2024-04-15 19:39:03 +02:00
|
|
|
import { inputProps, useFormInput } from "./useFormInput.js"
|
|
|
|
|
import VCheckbox from "./components/VCheckbox.vue"
|
|
|
|
|
import InputWrapper from "./components/InputWrapper.vue"
|
2023-12-09 15:47:03 +01:00
|
|
|
|
|
|
|
|
export default {
|
2024-04-15 19:39:03 +02:00
|
|
|
name: "CheckboxInput",
|
2023-12-09 15:47:03 +01:00
|
|
|
|
|
|
|
|
components: { InputWrapper, VCheckbox },
|
|
|
|
|
props: {
|
2024-04-15 19:39:03 +02:00
|
|
|
...inputProps,
|
2023-12-09 15:47:03 +01:00
|
|
|
},
|
|
|
|
|
|
2024-04-15 19:39:03 +02:00
|
|
|
setup(props, context) {
|
2023-12-09 15:47:03 +01:00
|
|
|
return {
|
2024-04-15 19:39:03 +02:00
|
|
|
...useFormInput(props, context),
|
2023-12-09 15:47:03 +01:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2024-04-15 19:39:03 +02:00
|
|
|
mounted() {
|
2024-01-17 14:52:32 +01:00
|
|
|
if (!this.compVal) {
|
|
|
|
|
this.compVal = false
|
|
|
|
|
}
|
2024-04-15 19:39:03 +02:00
|
|
|
},
|
2023-12-09 15:47:03 +01:00
|
|
|
}
|
|
|
|
|
</script>
|