其他分享
首页 > 其他分享> > elementui table多选回显

elementui table多选回显

作者:互联网

<template>
    <el-table @selection-change="handleSelectionChange" :row-key="getRowKeys">
        <!--type必须是selection的一列设置reserve-selection属性-->
      <el-table-column type="selection" :reserve-selection="true" width="40" align="center"></el-table-column>
      <el-table-column props="name" align="center"></el-table-column>
    </el-table>
</template>

<script>
     export default {
         data: {
             selection:[{name: '张三', id: 1}, {name: '李四', id: 2}]
         },
         methods: {
             handleSelectionChange (val) {
                 this.selection = val;
             },
             getRowKeys (row) {
                 return row.id; // id为列表数据的唯一标识
             }
         }
     }
</script>

 

标签:selection,val,回显,elementui,name,methods,table,id,row
来源: https://www.cnblogs.com/xmyfsj/p/16142862.html