我有一个带有复选框的表作为第一列。我想在标题中有一个全选复选框。我不确定如何解决此问题。
<template>
<table class="table table-hover">
<thead>
<tr>
<th><input type="checkbox" /></th>
<th>ID</th>
</tr>
</thead>
<tbody>
<tr>
<td><input type="checkbox" checked.bind="selected" model.bind="site" /></td>
<td>${site.id}</td>
</tr>
</tbody>
</table>
</template>
因此,解决此问题的最佳方法包括三个部分。我们需要绑定checked
属性和indeterminate
属性,并且需要处理change事件。