elementUITable的多選框:分頁選擇數據回顯,分頁保存選中的數據。


<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>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM