【发布时间】:2021-05-05 07:10:39
【问题描述】:
我有一个包含 2 列复选框的表格。
我想点击右侧选中值的第一个复选框。 注意:左侧的所有复选框均未禁用,右侧的所有复选框均已禁用。
编辑: 我的 DOM 看起来像这样:
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
{items.map(item) => (
<tr>
<td>
<input type="checkbox" />
</td>
<td>
<input type="checkbox" checked={item.posted} disabled />
</td>
</tr>
)
}
</tbody>
</table>
来自 api 的数据重申了这就是为什么复选框的选中状态是动态的
【问题讨论】:
-
你能分享你的 HTML DOM 吗?
-
@AlapanDas 更新我的问题
-
行数会根据API调用结果而变化吗?
标签: reactjs material-ui cypress