| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <!--
- Case à cocher
- @see https://vuetifyjs.com/en/components/checkboxes/
- -->
- <template>
- <v-container
- class="px-0"
- fluid
- >
- <v-checkbox
- v-model="data"
- :value="data"
- :label="$t(label_field)"
- :disabled="readonly"
- :error="error || !!violation"
- :error-messages="errorMessage || violation ? $t(violation) : ''"
- @change="onChange($event)"
- />
- </v-container>
- </template>
- <script lang="ts">
- import {defineComponent, useContext} from '@nuxtjs/composition-api'
- import {useError} from "~/composables/form/useError";
- export default defineComponent({
- props: {
- field: {
- type: String,
- required: false,
- default: null
- },
- label: {
- type: String,
- required: false,
- default: null
- },
- data: {
- type: Boolean,
- required: false
- },
- readonly: {
- type: Boolean,
- required: false
- },
- error: {
- type: Boolean,
- required: false
- },
- errorMessage: {
- type: String,
- required: false,
- default: null
- }
- },
- setup (props, {emit}) {
- const {store} = useContext()
- const {violation, onChange} = useError(props.field, emit, store)
- return {
- label_field: props.label ?? props.field,
- violation,
- onChange
- }
- }
- })
- </script>
- <style scoped>
- </style>
|