Table.vue 1.04 KB
<template>
  <md-table
    :data="listData"
    v-loading="loading"
  >
    <md-table-column
      type="index"
      label="序号"
      align="center"
      min-width="55"
      width="55"
    />
    <md-table-column
      label="姓名"
      min-width="100"
      prop="name"
      align="center"
    >
      <template slot-scope="scope">
        <span
          class="pointer"
          @click="showDetail(scope.row)"
        >{{scope.row.name}}</span>
      </template>
    </md-table-column>

    <md-table-column
      label="操作"
      min-width="200"
      fixed="right"
    >
      <template slot-scope="scope">
        <el-button
          type="primary"
          @click="showEditDialog(1, scope.row)"
        >修改</el-button>
      </template>
    </md-table-column>
  </md-table>
</template>

<script>
import { mapGetters } from 'vuex';
export default {
  props: {
    listData: { type: Array },
    showEditDialog: { type: Function },
    showDetail: { type: Function },
  },
  computed: {
    ...mapGetters(['loading']),
  },
};
</script>