[轉]Vue element怎么獲取table表格當前行數據和索引值


怎么拿表格當前行數據
平時我們在使用表格時通過template的slot-scope="scope",使用scope.row拿到當前行的數據

<el-table max-height="290" :data="userTableData" border style="width: 100%">
      <el-table-column label="名字">
            <template slot-scope="scope">
              {{scope.row.name}}
            </template>
      </el-table-column>
       <el-table-column label="年齡">
            <template slot-scope="{row}">
              {{row.age}}
            </template>
      </el-table-column>
</el-table>

怎么拿表格當前行索引值

<el-table max-height="290" :data="userTableData" border style="width: 100%">
      <el-table-column label="序號">
            <template slot-scope="scope">
                  {{scope.$index+1}} 
            </template>
      </el-table-column>
</el-table>

From: https://blog.csdn.net/meimeib/article/details/111075715

 


免責聲明!

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



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