组件传值prop 必须使用指定引用地址的数据

如果像下面这样 取为空shop 中的phone ,后续获取数据或就算 shop中有phone元素 子组件也无法获取到修改后的值

<template>
    <call :phone.sync='shop.phone'></call>
</template>

<script>

 data = {  
      phone:'',
      shop: {},
    }
</script>

必须这样:直接调用存在对象,后续更新 子组件也能获取数据

<template>
    <call :phone.sync='phone'></call>
</template>

<script>

 data = {  
      phone:'',
      shop: {},
    }
</script>

 

这个坑,坑了我2小时!

 

相关文章:

  • 2022-12-23
  • 2021-09-21
  • 2022-12-23
  • 2021-08-15
  • 2022-12-23
  • 2022-01-12
  • 2022-01-19
  • 2021-06-10
猜你喜欢
  • 2021-09-27
  • 2021-06-05
  • 2021-08-05
  • 2022-12-23
  • 2022-01-15
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案