我是新手,需要帮助, 如果不关闭模态,它不会更新。 为简化起见,单击我的按钮,它应该显示我的数据结果。 而且,如果我在不关闭模式的情况下更改按钮,那么我希望更新结果(text1和text2的乘法)。
预先感谢
https://codesandbox.io/s/red-leftpad-6oed4?file=/src/timeline.vue
答案 0 :(得分:0)
在代码框的modal.vue
中,使用一个watch
或computed property
来获取最新的infosModal
(当依赖项时,将触发监视或重新计算属性被更改)。 timeline.vue
应该做同样的事情。
例如,在modal.vue
中,添加以下内容:
watch: {
'infosModal': function (newVal) {
this.test = newVal
}
},
computed: {
computedInfosModal: function() {
return Object.assign({}, this.infosModal);
}
},