说明:
1.改变表头居中问题: 需要在el-table-column中添加 header-align="center"
<el-table :data="tableData" style=" 100%" >
<el-table-column prop="date" header-align="center" label="日期">
</el-table-column>
<el-table-column prop="id" header-align="center" label="姓名">
<template slot-scope="scope">
<el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
data() {
return {
tableData: [{
date: '描述描述描述描述描述',
id: '0'
}, {
date: '描述描述描述描述描述',
id: '1'
}, {
date: '描述描述描述描述描述',
id: '2'
}, {
date: '描述描述描述描述描述',
id: '3'
}]
}
},
methods: {
handleDelete(index, row) {
alert(index+"row=="+row);
}
}