引入指令
import moment from 'moment'
引入moment.js文件 时间转换插件
方法一:
<el-table-column
prop="configTime"
label="配置时间"
:formatter="r => formatTime(r.configTime)"
min-width="160"
>
方法二:
<el-table-column width="160" label="配置时间">
<template slot-scope="scope">
{{ formatTime(scope.row.configTime) }}
</template>
</el-table-column>
methods: {
formatTime(val) {
if (!val) {
return ''
}
return moment(val).format('YYYY/MM/DD')
},
}