vue elementui el-table 默认选中
参考:https://blog.csdn.net/qyl_0316/article/details/108583481
table
<el-table :data="slicingProcessList" class="table-box table1" height="250" ref="table1" @selection-change="handleSelectionChange1" > <el-table-column type="selection" width="30" align="center" />
list返回数据
this.$nextTick(() => { this.slicingProcessList.forEach((row) => { if (row.chooseFlag == 1) { this.$refs["table1"].toggleRowSelection(row, true); } }); });
多选框选中
handleSelectionChange1(selection) { this.ids = selection.map((item) => item.id); this.codes = selection.map((item) => item.code); this.single = selection.length !== 1; this.multiple = !selection.length; },