在vue的子组件中更新props值

时间:2019-12-18 05:46:08

标签: javascript vue.js

parent.vue

<template>
...
<div>{{ meet}} </div>
...
</template>
...
props: ["meet"]

child.vue

<template>
...
<meet :meet="showMeet(e.id)" /> 
</template>
...
props: ['meet'],
...
methods: {
   showMeet(id) {
      this.meet == 'abc';
   }
}

我如何更新要在子组件中使用的道具的值

1 个答案:

答案 0 :(得分:0)

您可能需要再次重新渲染子组件。根据我到目前为止的理解,同一个道具存在于孩子的道具中,如果您从一个值更新它的值,那么您也想在第二个值中更新它。请参考

https://michaelnthiessen.com/force-re-render/

相关问题