这里处理的 原始时间格式 为 : 需要达到的效果 :
//安装 npm install moment
//main.js 文件 import moment from 'moment' //引入 // 挂载 时间处理 2022-06-12T00:00:00.000 0800 Vue.prototype.moment = moment Vue.filter('dateFormat', function (dateStr, pattern = 'YYYY-MM-DD HH:mm:ss') { return moment(dateStr).format(pattern) })
//应用 table <el-table-column label="日期" width="150"> <template slot-scope="scope"> {
{scope.row.dataTime | dateFormat}}</template> </el-table-column>