【发布时间】:2020-07-19 13:03:22
【问题描述】:
这是我的代码。 单击“添加新行”按钮时,添加一个空行即可。 但是,我需要在新表行中添加复制现有行数据。 请帮我。
addMarkerLine(){
this.form.markeratios.push({
size:null,
ratio:0,
})
},
<form action="">
<table>
<thead>
<tr>
<th>SL.</th>
<th>Size</th>
<th>Ratio</th>
<th>Action</th>
</tr>`enter code here`
</thead>
<tbody>
<tr v-for="(markeratio , index) in form.markeratios ">
<td >{{index + 1}}</td>
<td ><input type="text" v-model="markeratio.size"></td>
<td ><input type="text" v-model="markeratio.ratio"></td>
<td><button>Copy This Line</button></td>
</tr>
</tbody>
<tfoot>
<tr>
<td><span @click="addMarkerLine">Add New Line</span></td>
</tr>
</tfoot>
</table>
</form>
【问题讨论】:
-
您能否更详细地解释您想要什么或澄清您的问题。
-
这里我使用 push 方法来添加新行,这很好。但我需要复制我现有的行并在添加空白行的新行中过去。
标签: vuejs2 laravel-5.7