这里处理的 原始时间格式 为 : 2022-06-12T00:00:00.000+0800
需要达到的效果 :2022-06-12 00:00:00

//安装
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>
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐