element中table单元格点击事件获取id

1、template部分

<template>
  <el-table :data="tableData" stripe border style=" 100%">
    <el-table-column prop="checkUnit" label="医院名称"></el-table-column>
    <el-table-column prop="checkName" label="检查名称"></el-table-column>
    <el-table-column label="查看详情">
       <template slot-scope="scope">
          <el-button size="mini" @click="infoList_detial(scope.row.id)">查看详情</el-button>
       </template>
    </el-table-column>
  </el-table>
</template>

2、js部分

export default {
  name: 'ExperimentalExamination',
  data () {
    return {
      tableData: [{
        id:1
        checkUnit:医院1,
        checkName:名称1
      },{
        id:2
        checkUnit:医院2,
        checkName:名称2
      },{
        id:3
        checkUnit:医院3,
        checkName:名称3
      }]
    }
  },
  methods:{
    infoList_detial(id){
        console.log(id);
    }
}
原文地址:https://www.cnblogs.com/panchanggui/p/15016159.html