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