<template> <div class="table-container"> <el-row class="table-title"> <el-col :span="6"><div class="title-header"><i class="el-icon-menu"/>数据列表</div></el-col> </el-row> <el-table ref="table" :data="list" class="table" border> <el-table-column align="center" type="index" /> <el-table-column v-for="column in tableColumns" :key="column.value" :label="column.text" align="center"> <template slot-scope="scope"> <span v-if="column.type!='button'">{{ scope.row[column.value] }}</span> <el-button v-if="column.type=='button'" type="text" @click="showCaseList(scope.row,column.value)">{{ scope.row[column.value] }}</el-button> </template> </el-table-column> </el-table> </div> </template> <script> export default { name: 'DeptAccessList', props: { list: { type: Array, default() { return [] } } }, data() { return { tableColumns: [ { text: '单位名称', value: 'deptName', type: 'text' }, { text: '上期结转数', value: 'lastCarryOver', type: 'button' }, { text: '本期应处置数', value: 'shouldProcess', type: 'button' } ] } }, methods: { showCaseList(row, value) { console.log(row, value) } } } </script> <style rel="stylesheet/scss" lang="scss" scoped> $tableTitleHeight:46px; .table{ margin-bottom: 20px; } .table-title{ background-color:rgba(243, 243, 243, 1); height: $tableTitleHeight; .title-header{ line-height:$tableTitleHeight; color: #606266; font-size: 15px; i{ margin-left: 5px; margin-right: 5px; } } } </style>