I am new to vue.js. I am working on form. I have a add button in my form, as user click on this button same form field will be added to this form. And user can add as many times he/she want. For this my data is .
data () {
return {
form: [{
fieldOne: '',
fieldTwo: '',
}]
}
}
As user click on add buton in html my addForm fucntion is called.
addForm() {
let newObject = {
fieldOne: '',
fieldTwo: '',
}
this.form.push(newObject); // Gives error.
}
I read about Vue.set. I can easliy add single field or object. But I don't know how to add object to my form array.
Please help me out.