35 lines
1.2 KiB
Vue
35 lines
1.2 KiB
Vue
<template>
|
|
<v-radio :label="field.name" :options="field.options" :allowcustom="field.allowcustom" :intro="field.intro" v-model="inner" :hint="field.hint" :id="field.key" :required="field.required"></v-radio>
|
|
</template>
|
|
|
|
<script setup>
|
|
import {computed} from 'vue';
|
|
import VRadio from './VRadio.vue';
|
|
|
|
const emit = defineEmits(['update:modelValue']);
|
|
const props = defineProps({
|
|
modelValue: {
|
|
required: true,
|
|
validator: (value) => value === null || typeof value === 'string',
|
|
},
|
|
field: {
|
|
required: true,
|
|
validator: (value) =>
|
|
hasKeys(value, [...globalFieldRules(), 'required', 'options', 'allowcustom']) &&
|
|
typeof value.required === 'boolean' &&
|
|
typeof value.allowcustom === 'boolean' &&
|
|
typeof value.key === 'string' &&
|
|
value.key.length > 0 &&
|
|
typeof value.name === 'string' &&
|
|
value.name.length > 0 &&
|
|
hasKeys(value.columns, ['mobile', 'desktop', 'tablet']) &&
|
|
typeof value.options === 'object',
|
|
},
|
|
});
|
|
|
|
const inner = computed({
|
|
get: () => props.modelValue,
|
|
set: (v) => emit('update:modelValue', v),
|
|
});
|
|
</script>
|