【发布时间】:2019-08-17 01:28:54
【问题描述】:
我的组件中有一个 Prop,它是一个 User 对象,然后我有这个功能:
onChange: function(event){
this.$v.$touch();
if (!this.$v.$invalid) {
this.$axios.put('update',{
code:this.user.code,
col:event.target.name,
val:event.target.value
}).then(response => {
this.user[event.target.name]=event.target.value
});
}
}
我可以在 Vue 控制台调试器中看到正确的属性已更新,该属性在创建组件时存在,但我引用它的模板没有刷新:
<p>Hi {{user.nickname}}, you can edit your details here:</p>
这都在同一个组件中,所以我不会导航到子级或父级。我确定 props 在我的代码中的其他地方是被动的?
【问题讨论】:
标签: javascript vue.js