我想要禁用基于条件的点击事件'delete hours'与'x'符号。另外,我想在视觉上禁用这个表的行。提前谢谢你。
<table navigatable class="<some_class>">
<tbody>
<tr *ngFor="let item of list; let i=index">
<td style="width: 95%">{{item}}</td>
<td style="width: 5%">
<span class="<some_class>" (click)="DeleteHour(i)">X</span>
</td>
</tr>
</tbody>
</table>
试试看:(我也更改了html中的一些代码)
null
function DeleteHour(e){
e.parentNode.style.display = "none";
e.parentNode.previousElementSibling.style.display="none";
}
<table navigatable class="<some_class>">
<tbody>
<tr *ngFor="let item of list; let i=index">
<td style="width: 95%">{{item}}</td>
<td style="width: 5%">
<span class="<some_class>" onclick="DeleteHour(this)">X</span>
<td style="width: 95%">{{item}}</td>
<td style="width: 5%">
<span class="<some_class>" onclick="DeleteHour(this)">X</span>
<td style="width: 95%">{{item}}</td>
<td style="width: 5%">
<span class="<some_class>" onclick="DeleteHour(this)">X</span>
</td>
</tr>
</tbody>
</table>