Complete the code to declare a reactive variable using the script setup syntax.
<script setup> import { ref } from 'vue' const count = [1](0) </script>
In Vue's script setup syntax, ref is used to declare a reactive variable holding a simple value.
Complete the code to define a function inside the script setup block.
<script setup> function [1]() { console.log('Hello from setup') } </script>
Functions inside script setup are declared normally. Here, sayHello is a valid function name.
Fix the error in the script setup syntax to correctly import and use a reactive object.
<script setup> import { [1] } from 'vue' const state = [1]({ count: 0 }) </script>
The reactive function creates a reactive object. It must be imported and used consistently.
Fill both blanks to correctly define a computed property inside script setup.
<script setup> import { computed } from 'vue' const doubleCount = computed(() => state.[1] * [2]) </script>
The computed property multiplies the reactive count by 2 to get doubleCount.
Fill all three blanks to correctly emit an event from a component using script setup syntax.
<script setup> const emit = defineEmits(['[1]']) function sendMessage() { emit('[2]', [3]) } </script>
The event named 'update' is declared and emitted with the message 'Hello World!'.