yale-user-access/packages/frontend/components/yale/FormInput.vue
Liam Pietralla f577617b4d
All checks were successful
Build and Publish / Build Yale Access Backend (push) Successful in 28s
Build and Publish / Build Yale Access Frontend (push) Successful in 47s
Build and Publish / Push Yale Access Backend Docker Image (push) Successful in 9s
Build and Publish / Push Yale Access Frontend Docker Image (push) Successful in 10s
initial commit
2025-01-10 08:37:18 +11:00

25 lines
698 B
Vue

<script setup lang="ts">
import type { HTMLInputTypes } from '~/types/html-input-types';
const props = defineProps<{
type: HTMLInputTypes
placeholder: string
modelValue: string
}>();
const emit = defineEmits([
'update:modelValue'
])
const handleInput = (event: Event) => {
// If input is a text input, emit the value
if (props.type === 'text' || props.type === 'password') {
emit('update:modelValue', (event.target as HTMLInputElement).value);
}
}
</script>
<template>
<input class="bg-zinc-900 p-2 rounded-md" :type="props.type"
:value="props.modelValue" :placeholder="props.placeholder" @input="handleInput">
</template>~/types/html-input-types