Is there any reason why these 2 v-model bindings below would behave differently?
// component that uses FormExample
<script setup>
const fullName = someObject.fullName
</script>
<template>
// this works
<InputText v-model="fullName"/>
// this does not work
<InputText v-model="someObject.fullName"/>
</template>
asked May 23, 2024 at 14:26
user2263572
5,6165 gold badges40 silver badges61 bronze badges
1 Answer 1
Found a solution.
Issue is that the setup function doesn't unwrap refs recursively.
Therefore, you need to do it yourself.
<InputText v-model="someObject.fullName.value"/>
answered May 23, 2024 at 16:15
user2263572
5,6165 gold badges40 silver badges61 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-js
someObjectdefined? what is the InputText component? whatever is assigned to v-model should be defined as reactive... Try making your minimal example using https://play.vuejs.org/