这里需要使用到一个插件:moment
1 npm 安装(--save表示保存到package.json中)
npm install moment
2 main.js中定义全局变量
import moment from 'moment'
Vue.prototype.$moment = moment
3 组件中的使用
<el-table-column prop="createTime" label="开始时间">
<template slot-scope="scope">
{{ moment(scope.row.createTime).format("YYYY-MM-DD HH:mm:ss") }}
</template>
</el-table-column>