vue element-ui get index of table row vue element-ui get index of table row vue.js vue.js

vue element-ui get index of table row


I found a solution to this by using the $index variable, which is the index of the current row.

<div v-if="scope.$index === 0">


vue template & scope.$index

my solution:

 <el-table    :data="tableData"    border    class="app-downlaod-guide-table"    style="width: 100%">    <el-table-column      v-for="({        prop,        label,        align,        width,        slot,      }, i) in channelClomuns"      :key="prop + i"      :prop="prop"      :width="width"      :align="align"      :label="label">      <template        slot-scope="scope"        v-if="prop === `putLink`">        <a          target="_blank"          href="tableData[scope.$index].putLink">          {{tableData[scope.$index].putLink}}        </a>      </template>    </el-table-column>  </el-table>