frontend/vue.js

vue.js: reset data

seul chan 2018. 6. 11. 18:54
...
methods: {
    resetData: function() {
      Object.assign(this.$data, this.$options.data());
    },
}
...

Object.assign()

Object.assign(target, ...sources)
  • Properties in the target object will be overwritten by properties in the sources if they have the same key.

More detail MDN web docs


'frontend > vue.js' 카테고리의 다른 글

vue.js: Multiple search  (0) 2018.06.12
Starting vue - vue 공식문서 정리 (~computed, watch)  (0) 2018.06.01
vue.js Router: vue-router  (0) 2018.01.30
vue.js: http via Vue Resource  (0) 2018.01.26
vue.js form 사용법  (0) 2018.01.23