Computer scienceFrontendVue.jsVue 3 SyntaxVue Directives

v-model with custom components

Theory

Error

Report a typo

This code is broken. What caused the problem?

<script setup>
defineProps({
    modelValue: Boolean
});
const emit = defineEmits(['update:modelValue']);
</script>

<template>
    <input 
        :value="modelValue"
        type="checkbox" 
        @input="emit('update:modelValue', $event.target.value)" 
    />
</template>
Select one option from the list
___

Create a free account to access the full topic