og-image/src/ui/InputForm.vue

44 lines
867 B
Vue
Raw Normal View History

2023-02-24 21:40:50 +01:00
<template>
2023-02-24 21:46:46 +01:00
<label
v-if="label"
class="block text-sm font-medium text-gray-700"
:for="id"
v-text="label"
/>
2023-02-24 21:40:50 +01:00
<input
2023-02-24 21:46:46 +01:00
:id="id"
2023-02-24 21:40:50 +01:00
class="mt-2 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50"
:type="type"
:value="modelValue"
2023-02-26 17:44:43 +01:00
:class="$attrs.class"
2023-02-24 21:40:50 +01:00
@change="$emit('change', $event)"
@input="$emit('update:modelValue', $event.target.value)"
2023-02-24 21:46:46 +01:00
>
2023-02-24 21:40:50 +01:00
</template>
<script>
export default {
props: {
modelValue: {
2023-02-26 17:44:43 +01:00
type: String,
default: null,
2023-02-24 21:40:50 +01:00
},
label: {
type: String,
2023-02-26 17:44:43 +01:00
default: null,
2023-02-24 21:40:50 +01:00
required: false,
},
type: {
type: String,
required: false,
default: 'text'
},
id: {
type: String,
required: true,
},
},
2023-02-26 17:44:43 +01:00
emits: ['update:modelValue', 'change'],
2023-02-24 21:40:50 +01:00
}
</script>