Add: Delete button value
This commit is contained in:
parent
765a9d009f
commit
4db01b7bc6
|
@ -2,12 +2,20 @@
|
||||||
<span class="text-gray-600 flex bg-white items-center text-xs @sm:text-sm" :class="{'left-0 ': inline, 'left-2 px-1 absolute -top-3': !inline}">
|
<span class="text-gray-600 flex bg-white items-center text-xs @sm:text-sm" :class="{'left-0 ': inline, 'left-2 px-1 absolute -top-3': !inline}">
|
||||||
<span v-text="name"></span> <span v-show="required" class="text-red-800 ml-1">*</span>
|
<span v-text="name"></span> <span v-show="required" class="text-red-800 ml-1">*</span>
|
||||||
<hint :value="hint" class="ml-2" v-if="hint" small></hint>
|
<hint :value="hint" class="ml-2" v-if="hint" small></hint>
|
||||||
|
<button
|
||||||
|
v-if="button"
|
||||||
|
@click.prevent="$emit('buttonclick')"
|
||||||
|
class="text-primary hover:outline-none px-2 ml-3 py-1 leading-none hover:bg-primary hover:text-font transition rounded-full text-xs"
|
||||||
|
v-text="button"
|
||||||
|
></button>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import Hint from './Hint.vue';
|
import Hint from './Hint.vue';
|
||||||
|
|
||||||
|
defineEmits(['buttonclick']);
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
name: {},
|
name: {},
|
||||||
required: {},
|
required: {},
|
||||||
|
@ -15,6 +23,10 @@ defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: () => false,
|
default: () => false,
|
||||||
},
|
},
|
||||||
|
button: {
|
||||||
|
required: false,
|
||||||
|
default: () => '',
|
||||||
|
},
|
||||||
hint: {
|
hint: {
|
||||||
required: false,
|
required: false,
|
||||||
validator: (value) => value === null || typeof value === 'string',
|
validator: (value) => value === null || typeof value === 'string',
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="relative">
|
<div class="relative">
|
||||||
<field-label :name="field.name" :required="field.required" :hint="field.hint" inline></field-label>
|
<field-label :name="field.name" :required="field.required" :hint="field.hint" :button="modelValue === null ? '' : 'Option löschen'" @buttonclick="selected = null" inline></field-label>
|
||||||
<div class="grid grid-cols-1 gap-2 pt-1">
|
<div class="grid grid-cols-1 gap-2 pt-1">
|
||||||
<label v-for="(option, index) in field.options" :key="index" :for="`${innerId}-${index}`" class="block relative flex items-center">
|
<label v-for="(option, index) in field.options" :key="index" :for="`${innerId}-${index}`" class="block relative flex items-center">
|
||||||
<input :id="`${innerId}-${index}`" v-model="selected" type="radio" :name="field.key" :value="option" class="peer absolute invisible" />
|
<input :id="`${innerId}-${index}`" v-model="selected" type="radio" :name="field.key" :value="option" class="peer absolute invisible" />
|
||||||
|
|
Loading…
Reference in New Issue