elementui中tabel组件的scope.$index的使用

tabel组件的自定义列模板中可以使用scope.row获取当前行的数据,而scope.$index获取的是当前行的数据在数组中的索引(tabel表格绑定的数据是一个数组,数组中每一个对象就相当于一行的数据)
使用如下:

<el-table-column prop="age" label="年龄">
  <template slot-scope="scope">
    <span @click="editor(scope.row,scope.$index)">编辑span>
  template>
el-table-column>

你可能感兴趣的:(elementui,vue.js,前端)