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

28 lines
939 B
Vue
Raw Normal View History

2024-04-14 11:47:48 +02:00
<template>
2024-06-28 12:43:05 +02:00
<f-switch
id="fieldrequired"
:model-value="modelValue.required"
label="Erforderlich"
size="sm"
name="fieldrequired"
inline
@update:modelValue="$emit('update:modelValue', {...modelValue, required: $event})"
></f-switch>
<f-text id="min" :model-value="modelValue.min" label="minimaler Wert" size="sm" type="number" @update:modelValue="$emit('update:modelValue', {...modelValue, min: parse($event)})"></f-text>
<f-text id="max" :model-value="modelValue.max" label="maximaler Wert" size="sm" type="number" @update:modelValue="$emit('update:modelValue', {...modelValue, max: parse($event)})"></f-text>
2024-04-14 11:47:48 +02:00
</template>
<script setup>
const props = defineProps({
modelValue: {},
meta: {},
payload: {},
});
function parse(input) {
return parseInt(input) === NaN ? null : parseInt(input);
}
const emit = defineEmits(['update:modelValue']);
</script>