elementui table多选回显

2022/4/14 6:15:38

本文主要是介绍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>

 



这篇关于elementui table多选回显的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程