2022-10-18 06:49:00 +00:00
|
|
|
<template>
|
|
|
|
<div :class="wrapperClass">
|
2023-04-19 08:13:50 +00:00
|
|
|
<small v-if="help && helpPosition=='above_input'" :class="theme.default.help" class="flex mb-1">
|
|
|
|
<slot name="help"><span class="field-help" v-html="help" /></slot>
|
|
|
|
</small>
|
2022-10-18 06:49:00 +00:00
|
|
|
<div class="flex">
|
|
|
|
<v-switch :id="id?id:name" v-model="compVal" class="inline-block mr-2" :disabled="disabled" :name="name" @input="$emit('input',$event)" />
|
2023-08-30 07:58:29 +00:00
|
|
|
<slot name="label">
|
|
|
|
<span>{{ label }} <span v-if="required" class="text-red-500 required-dot">*</span></span>
|
|
|
|
</slot>
|
2022-10-18 06:49:00 +00:00
|
|
|
</div>
|
2023-04-19 08:13:50 +00:00
|
|
|
<small v-if="help && helpPosition=='below_input'" :class="theme.default.help">
|
|
|
|
<slot name="help"><span class="field-help" v-html="help" /></slot>
|
2022-10-18 06:49:00 +00:00
|
|
|
</small>
|
|
|
|
<has-error v-if="hasValidation" :form="form" :field="name" />
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2023-01-21 11:57:37 +00:00
|
|
|
import inputMixin from '~/mixins/forms/input.js'
|
2022-10-18 06:49:00 +00:00
|
|
|
|
2023-01-21 11:57:37 +00:00
|
|
|
import VSwitch from './components/VSwitch.vue'
|
2022-10-18 06:49:00 +00:00
|
|
|
export default {
|
|
|
|
name: 'ToggleSwitchInput',
|
|
|
|
|
|
|
|
components: { VSwitch },
|
|
|
|
mixins: [inputMixin],
|
|
|
|
props: {},
|
|
|
|
|
|
|
|
mounted () {
|
|
|
|
this.compVal = !!this.compVal
|
|
|
|
this.$emit('input', !!this.compVal)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|