elementUI table组件获取表格当前行的索引

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_39759115/article/details/82287352

一般情况下,我们通过 scope.row 获取每一行的数据,但是怎么获取每一行的索引呢?

答案就在下面:

        <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-column prop="user_nickname" label="用户昵称">
          </el-table-column>
          <el-table-column prop="create_time" label="提交时间">
          </el-table-column>
        </el-table>

猜你喜欢

转载自blog.csdn.net/qq_39759115/article/details/82287352
今日推荐