adrema/resources/js/views/formtemplate/RadioField.vue

35 lines
1.1 KiB
Vue
Raw Normal View History

2023-12-26 00:44:49 +01:00
<template>
<div class="space-y-1">
<span class="text-xs font-semibold text-gray-400">Optionen</span>
<f-text
v-for="(option, index) in modelValue.options"
:id="`options-${index}`"
:key="index"
size="sm"
:name="`options-${index}`"
:model-value="option"
@update:modelValue="$emit('update:modelValue', {...props.modelValue, options: props.modelValue.options.toSpliced(index, 1, $event)})"
></f-text>
<ui-icon-button icon="plus" @click="$emit('update:modelValue', {...modelValue, options: [...modelValue.options, '']})">Option einfügen</ui-icon-button>
</div>
2023-12-26 20:20:32 +01:00
<f-switch
id="fieldrequired"
v-model="modelValue.required"
label="Erforderlich"
size="sm"
name="fieldrequired"
inline
@update:modelValue="$emit('update:modelValue', {...modelValue, required: $event})"
></f-switch>
2023-12-26 00:44:49 +01:00
</template>
<script setup>
const props = defineProps({
modelValue: {},
2023-12-31 14:29:50 +01:00
meta: {},
payload: {},
2023-12-26 00:44:49 +01:00
});
const emit = defineEmits(['update:modelValue']);
</script>