♻️ (production flow) use of defineModel

This commit is contained in:
Julien Calixte
2023-05-29 11:04:16 +02:00
parent d8dbce2fd7
commit 95cdd26c2b
2 changed files with 4 additions and 11 deletions

View File

@@ -2,22 +2,15 @@
defineProps<{
id: string
label: string
modelValue: string
}>()
defineEmits<{
(event: "update:modelValue", value: string): void
}>()
const modelValue = defineModel<string>()
</script>
<template>
<div class="form-input">
<label :for="id">{{ label }}</label>
<input
type="text"
id="id"
:value="modelValue"
@input="$emit('update:modelValue', $event.target?.value ?? '')"
/>
<input type="text" id="id" v-model="modelValue" />
</div>
</template>