1.el-table中,设置复选框
<el-table
ref="multipleTable"
:data="rightforeach"
tooltip-effect="dark"
class="surface"
max-height="400"
max-width="472"
@select="handleSelectionright"
@expand-change="expandChange"
:show-header="false"
stripe
>
<el-table-column
type="selection"
width="55"
v-if="check"
> </el-table-column>
</el-table>
当我们有需求,需要在后端接口返回中,获取到默认选中的复选框
//以下rightforeach就类似后端返回的数据
this.rightforeach.forEach((Element,index) => {
//判断如果选中了
if(Element.flag == 1){
_this.$nextTick(() => {
//让该条数据的复选框默认选中
_this.$refs.multipleTable.toggleRowSelection(Element,true)
})
}
})
有问题可直接留言