vue.js 无法正确将 v-model 绑定到对象值

问题描述 投票:0回答:1

下面这 2 个 v-model 绑定是否有不同的行为?

// 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>
vue.js vee-validate v-model
1个回答
0
投票

找到解决方案。

问题是设置函数不会递归地解开引用。

因此,你需要自己做。

<InputText v-model="someObject.fullName.value"/>
© www.soinside.com 2019 - 2024. All rights reserved.