Complete the code to bind the input value using v-model.
<template> <input type="text" [1]="name" /> <p>Your name is: {{ name }}</p> </template> <script setup> import { ref } from 'vue' const name = ref('') </script>
The v-model directive creates a two-way binding between the input and the variable name.
Complete the code to initialize the reactive variable for v-model.
<script setup> import { [1] } from 'vue' const message = [2]('Hello') </script>
Use ref to create a reactive variable that works with v-model.
Fix the error in the code to correctly bind the checkbox with v-model.
<template> <input type="checkbox" [1]="checked" /> <p>Checked: {{ checked }}</p> </template> <script setup> import { ref } from 'vue' const checked = ref(false) </script>
Checkboxes use v-model to bind their checked state to a variable.
Fill both blanks to create a two-way binding with a select dropdown.
<template> <select [1]="[2]"> <option value="red">Red</option> <option value="green">Green</option> <option value="blue">Blue</option> </select> <p>Selected color: {{ color }}</p> </template> <script setup> import { ref } from 'vue' const color = ref('red') </script>
The v-model directive binds the color variable to the select's value for two-way binding.
Fill all three blanks to create a two-way binding with a textarea and display its length.
<template> <textarea [1]="[2]"></textarea> <p>Length: {{ [3].length }}</p> </template> <script setup> import { ref } from 'vue' const text = ref('') </script>
Use v-model to bind the textarea to text. Display the length with text.length.
