【vue.js】子组件的参数值不随着父组件值的改变而改变

来源:互联网 发布:mac表格使用教程 编辑:程序博客网 时间:2024/05/22 12:24

子组件 props['myDetail']


父组件

computed:{detail(){return this.$store.state.XXXX.yyyy}}

<子组件 :myDetail="detail"></子组件>

然而当store里的值改变,子组件的值并不会改变

应修改为

父组件

data:{detail:{}}
methods:{reloadDetail(){this.detail = JSON.parse(JSON.stringify(this.$store.stat.XXXX.yyyy));}}

这样子组件的值就会随着父组件的值改变而改变



0 0