父组件传递给子组件一个名为count数据,但是现在要在子组件中修改它的值并且实时更新页面,直接this.item.count是不能直接修改他的值的
可以通过computed计算属性来间接修改父组件传递的值
子组件更改传入的值
<template>
<div class='goodsBasic'>
<div>{{ info.count}}</div>
</div>
</template>
props: {
item: {
type: Object,
default () {
return {}
}
}
},
computed: {
info() {
return this.item
}
},
data () {
return {
}
}