vue.js

关注公众号 jb51net

关闭
首页 > 网络编程 > JavaScript > javascript类库 > vue.js > vue el-table设置selection选中状态

vue el-table设置selection选中状态实现方式

作者:不想上班只想要钱

在Vue使用Element UI的el-table组件时,toggleRowSelection方法用于切换行的选中状态,关键代码通常涉及调用该方法并传入行数据和选中状态(true或false),以实现行的选中或取消选中

vue el-table设置selection选中状态

toggleRowSelection 方法

vue el-table 设置selection选中状态

关键代码

multipleTableRef.value!.toggleRowSelection(item, true);
<el-table
			:data="data"
			:border="setBorder"
			v-bind="$attrs"
			row-key="id"
			stripe
			style="width: 100%"
			v-loading="config.loading"
			@selection-change="onSelectionChange"
			header-row-class-name="headerClass"
			ref="multipleTableRef"
		>
</el-table>

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。

您可能感兴趣的文章:
阅读全文