我想在表格主体的特定行中显示图标以删除该行。我搜索了解决方案并尝试了,但效果并不好。
在所有行中显示图标很容易,但很难仅在特定行中显示。
下面的代码是我正在处理的简单版本。我希望有人知道解决方案。
<table>
<thead>
<tr>
<th>Title</th>
<th>Category</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<tr each={ article in articles } onmouseover={ onMouseOver }>
<td>{ article.title }<i class='fa fa-trash-o' aria-hidden='true' show={ parent.showTrash }></i></td>
<td>{ article.category }</td>
<td>{ article.date }</td>
</tr>
</tbody>
</table>
<script>
this.articles = [
{title: 'This is How Japanese Makeup' date: 'Oct 7 2016', category:'Makeup'},
{title: 'This is Japanese Fashion' date: 'Oct 8 2016', category:'Fashion'},
{title: 'This is Japanese Food' date: 'Oct 9 2016', category:'Food'}
]
onMouseOver(e) {
e.item.article.showTrash = true
}
</script>