resetfileds失效问题

在vue中我们使用el-dialog时,先点击编辑,再点击新增时,会出现被填充的情况,此时已经设置对话框关闭后resetfileds,但是仍然不起作用。

解决:在设置回显值的时候,不要直接赋值,在外边加上setTimeout或者this.$nextTick

this.dialogVisiblews=true;
this.$nextTick(function(){
  this.formData = response.data;
 })
//setTimeout(function(){
 // this.formData = response.data;
 //},3000)

你可能感兴趣的:(vue.js,javascript,前端)