laracasts / Vue-Forms

https://laracasts.com/series/learn-vue-2-step-by-step/episodes/19
396 stars 204 forks source link

form.reset() not working for nested objects #26

Open atheleron opened 4 years ago

atheleron commented 4 years ago

here is reset part of form class

reset() {     
  for (let field in this.originalData) {
    this[field] = this.originalData[field];
  }
}

If you have form object like this only first level of form is cleared nested fields inside lte, wcdma and edge are not cleared??

form: new Form({
    contact: '',
    phone: '',
    address: '',
    active: true,
    mesured: {
        lte: {
            cell: '',
            signal: 0,
            download: 0,
            upload: 0
        },
        wcdma: {
            cell: '',
            signal: 0,
            download: 0,
            upload: 0
        },
        edge: {
            cell: '',
            signal: 0,
            download: 0,
            upload: 0
       }
   }
})
webman2030 commented 4 years ago

same here