[转]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