相关版实例代码如下:
<Meta charset="UTF-8">
vue实例:添加删除元素r
name:
@H_502_13@
age:
@H_502_13@
sex:
@H_<a href="/tag/502/" target="_blank" class="keywords">502</a>_13@
<div class="form-group">
<label></label>
<button v-on:click = 'addPerson'>Create</button>
@H_<a href="/tag/502/" target="_blank" class="keywords">502</a>_13@
<table>
<thead>
<tr>
<th>Name</th>
<th>Age</th>
<th>Sex</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
<tr v-for="item in items"><!--v-for-->
<td>{{item.name}}</td>
<td>{{item.age}}</td>
<td>{{item.sex}}</td>
<td><button @click="deletePerson($index)">Delete</button></td>
</tr>
</tbody>
</table>
@H_502_13@