user2263572
user2263572

Reputation: 5606

vue.js unable to correctly bind v-model to object value

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>

Upvotes: 0

Views: 68

Answers (1)

user2263572
user2263572

Reputation: 5606

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"/>

Upvotes: 0

Related Questions