Custom Click Event

Report a typo

You are working with a simple child component that emits a message event. Here is the Vue template:

<template>
  <button @click="emitClickEvent">Click me</button>
</template>

Arrange the script below to emit the click event.

Reorder lines using drag or arrows. Adjust indentation with left buttons
                const emitClickEvent = () => {
              
                <script setup>
              
                const emit = defineEmits(['click']);
              
                </script>
              
                emit('click', 'Hello, world!');
              
                };
              
___

Create a free account to access the full topic