Problem Statement
Show how to implement v-model in a Composition API component.
Explanation
Define a modelValue prop and emit update:modelValue when internal state changes. Wrap modelValue with a computed getter/setter to keep template bindings simple.
Code Solution
SolutionRead Only
const props = defineProps<{ modelValue: string }>()
const emit = defineEmits(['update:modelValue'])
const model = computed({
get: () => props.modelValue,
set: v => emit('update:modelValue', v)
})