JS部分
<script>
import request from '@/api/request'
export default {
name: 'BlogManage',
filters: {
/**
* 格式化时间
* @param time
* @returns {string}
*/
formatDate(time) {
let date = new Date(time)
let year = date.getFullYear()
let month = date.getMonth()
let day = date.getDate()
let hour = date.getHours()
let min = date.getMinutes()
let second = date.getSeconds()
return year + '-' + month + '-' + day + ' ' + hour + ':' + min + ':' + second
}
},
//其他代码逻辑省略 。。。
}
</script>
<el-table
v-loading="listLoading"
:data="blogList"
element-loading-text="Loading"
border
fit
highlight-current-row
>
<el-table-column align="center" label="ID" width="95">
<template slot-scope="scope">
{{ scope.$index }}
</template>
</el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">
<!-- 这里 -->
{{ scope.row.createDate | formatDate}}
</template>
</el-table-column>
</el-table>