在某些情况我们可能要重置data上面的某些属性,比如在表单提交后需要清空form

this.$data // 组件当前data对象
this.$options.data() // 组件初始化状态下的data对象

Object.assign(this.$data, this.$options.data()) // 重置data对象到初始化状态

转载于 北岛 https://blog.csdn.net/weixin_43416666/article/details/103376390

相关文章:

  • 2022-12-23
  • 2021-08-13
  • 2022-12-23
  • 2021-09-12
  • 2022-12-23
  • 2022-12-23
  • 2021-08-07
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-21
  • 2021-08-20
  • 2021-06-09
相关资源
相似解决方案