checkpoint
This commit is contained in:
32
frontend/src/components/InputField.vue
Normal file
32
frontend/src/components/InputField.vue
Normal file
@@ -0,0 +1,32 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
label: String,
|
||||
placeholder: String,
|
||||
inputError: String,
|
||||
forceValidate: Boolean,
|
||||
})
|
||||
const inputText = defineModel('inputText')
|
||||
|
||||
const touched = ref(false)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<label class="label">{{ props.label }}</label>
|
||||
<input
|
||||
:class="[
|
||||
'input w-full',
|
||||
{ 'input-error': (touched || props.forceValidate) && props.inputError !== '' },
|
||||
]"
|
||||
:placeholder="props.placeholder"
|
||||
v-model="inputText"
|
||||
@blur="touched = true"
|
||||
/>
|
||||
<div
|
||||
v-if="(touched || props.forceValidate) && props.inputError !== ''"
|
||||
class="text-error text-sm mt-1"
|
||||
>
|
||||
{{ props.inputError }}
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user