<div class="row">
<div class="col-md-4">
<div class="form-group label-floating">
<label class="control-label">Act</label>
<input type="text" class="form-control" v-model="act" >
</div>
</div>
<div class="col-md-4">
<div class="form-group label-floating">
<label class="control-label">Section </label>
<input type="text" class="form-control" v-model="section">
</div>
</div>
<button>Add row</button>
</div>
所以,当我点击添加按钮时,我需要继续添加上面的行。当我点击添加行按钮时,我应该如何添加这一行?
我需要将值传递为“BOOKED UNDER:”。
[{
act :,
section:,
}]
如果我有更多的行需要传递值,我需要将它们作为逗号分隔的值。我对js不够熟练,这是我的第一个遇到这种问题的项目。我该如何以这种方式添加值。
我的vue js代码如下:
addForm = new Vue({
el: "#addForm",
data: {
bookedUnder:[],
act: '',
section:'',
},
methods: {
handleSubmit: function(e) {
var vm = this;
data['otherNatureofOffense'] = //in the abve way
$.ajax({
url: 'http://localhost:3000/record/add/f/',
data: data,
type: "POST",
dataType: 'json',
success: function(e) {
if (e.status) {
vm.response = e;
alert("success")
} else {
vm.response = e;
console.log(vm.response);
alert(" Failed")
}
}
});
return false;
},
},
});
请帮我找一个解决方案