Table.vue 1.04 KB
Newer Older
姜雷 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
<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>