Fix events in another component

This commit is contained in:
Ramon Wenger 2023-04-19 15:56:27 +02:00
parent 4df91e7372
commit c3fccd6cce
1 changed files with 20 additions and 18 deletions

View File

@ -10,28 +10,30 @@
:placeholder="placeholder"
data-cy="input-with-label-input"
class="skillbox-input"
@input="$emit('input', $event.target.value)"
@input="input"
/>
</div>
</template>
<script>
export default {
props: {
value: {
type: String,
default: '',
},
label: {
type: String,
default: '',
},
placeholder: {
type: String,
default: '',
},
},
};
<script setup lang="ts">
export interface Props {
value?: string;
label?: string;
placeholder?: string;
}
withDefaults(defineProps<Props>(), {
value: '',
label: '',
placeholder: ''
});
const emit = defineEmits(['input']);
const input = (event: Event) => {
const value = (event.target as HTMLInputElement).value;
console.log(value);
emit('input', value);
}
</script>
<style scoped lang="scss">