我有一个表将生成动态组件,我想删除它,如果我点击删除按钮或处理其他事情。 我在这里做错了什么?尝试拼接和删除方法也无法正常工作。 请指教。删除动态生成的组件VueJS
<table>
<tr is="item-grid" v-for='index in counter'></tr>
<button @click="counter++" type="button">TEST ADD</button>
</table>
<template id="item-template">
<tr>
<td><input type="text" class="form-control" v-model="inventory_name" readonly/></td>
<td><input type="text" class="form-control" v-model="sku"/></td>
<td><input type="text" class="form-control" v-model="qty"/></td>
<td><input v-model="unit_price"></input></td>
<td><span v-text="unit_total"></span></td>
<td><button @click="remove(this)" type="button">delete</button></td>
</tr>
</template>
这是根成分,它?如果没有,只需从父组件内部删除它(例如用'v-if')。 – Cristy