](https://i-blog.csdnimg.cn/blog_migrate/bb8ba27be8d3f3cfed296cdce14264ce.png)
多选按钮的回显选中
<template>
<el-table ref="multipleTable" :data="splist" tooltip-effect="dark" style="width: 700px!important"
@selection-change="handleSelectionChange">
</el-table>
</template>
<script>
import { 接口名 } from '@/api/table'
export default {
name: '组件名',
/*props: {
number: {
type: String,
required: '',
},
},*/
data() {
return {
data:{}
}
},
mounted(){
this.detailinfo()
},
methods: {
async detailinfo() {
//参数
let num_data = {
}
const { data } = await 接口名(num_data )
this.splist=data.list
this.data = data
var that=this
if(data.number){
this.data.tknumber=true
this.$nextTick(() => {
data.list.forEach(function(row){
that.$refs.multipleTable.toggleRowSelection(row, true);
})
})
}
},
}
}
</script>
禁用多选按钮
可在表格el-table外层使用el-form包裹,并使用disabled,可禁用
//这里data.tknumber可动态改变
<el-form ref="data" :model="data" label-width="80px" :rules="rules" :disabled="data.tknumber">
<el-table ref="multipleTable" :data="splist" tooltip-effect="dark" style="width: 700px!important"
@selection-change="handleSelectionChange">
<el-table-column type="selection" min-width="30" align="center"></el-table-column>
</el-table>
</el-form>