Fix events in another component
This commit is contained in:
parent
4df91e7372
commit
c3fccd6cce
|
|
@ -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">
|
||||
|
|
|
|||
Loading…
Reference in New Issue