<el-table-column type="selection" width="55" align="center" />怎么控制选中
时间: 2023-11-05 10:22:25 浏览: 183
根据引用中的描述,如果想要控制<el-table-column type="selection" width="55" align="center" />的选中状态,可以使用::before伪元素给每一行的第一个td增加样式。具体做法是在el-table-column上添加样式,例如::
```
<el-table-column :prop="col.prop" align="center" :class-name="{'selected': row.isRed}" />
```
然后,在样式中定义.selected类来控制选中状态的样式,例如:
```
.selected::before {
content: "";
display: inline-block;
width: 10px;
height: 10px;
background-color: red;
border-radius: 50%;
}
```
这样,当row.isRed为true时,对应的行的第一个td就会显示选中的样式。 <span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [cmd.reg.txt](https://download.csdn.net/download/weixin_46040992/12046696)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [el-table多选表格type=“selection“获取当前行数据给多选框增加插槽逻辑](https://blog.csdn.net/misschengispink/article/details/127421323)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [<el-table>使用](https://blog.csdn.net/qq_45246098/article/details/129724314)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文