plugins/filter.js

import Vue from 'vue'
// 时间格式化
// 用法:<div>{{data | dataFormat('yyyy-MM-dd hh:mm:ss')}}</div>
Vue.filter('formatDate', function (value, fmt) {
let getDate = new Date(value);
let o = {
'M+': getDate.getMonth() + 1,
'd+': getDate.getDate(),
'h+': getDate.getHours(),
'm+': getDate.getMinutes(),
's+': getDate.getSeconds(),
'q+': Math.floor((getDate.getMonth() + 3) / 3),
'S': getDate.getMilliseconds()
};
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (getDate.getFullYear() + '').substr(4 - RegExp.$1.length))
}
for (let k in o) {
if (new RegExp('(' + k + ')').test(fmt)) {
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
}
}
return fmt;
})

nuxt.config.js

 plugins: ['@/plugins/element-ui', '@/plugins/filters.js'],

最新文章

  1. UI: 多窗口
  2. Wix 安装部署教程(九) --用WPF做安装界面
  3. Android获取焦点所在控件
  4. POJ3613 Cow Relays [矩阵乘法 floyd类似]
  5. svn删除目录后提交显示Item &#39;XXXX&#39; is out of date解决方法
  6. 解决UITabeleViewCell的分割线不能铺满问题
  7. Red and Black(简单dfs)
  8. linux路由表配置
  9. Spark SQL 源代码分析之 In-Memory Columnar Storage 之 in-memory query
  10. NPOI 2.0 教程(二):编辑既存的EXCEL文件
  11. word2-寻找社交新浪微博中的目标用户
  12. Pandas系列之入门篇
  13. 公众号用户发送消息后台PHP回复没有反应的解决办法
  14. cf1144E 假高精度平均数
  15. SpringBoot(十):读取application.yml下配置参数信息,java -jar启动时项目修改参数
  16. [转]SOA架构设计经验分享&mdash;架构、职责、数据一致性
  17. jenkins和svn搭建自动代码构建发布
  18. 第二篇:服务消费者(rest + ribbon)
  19. STM32.定时器
  20. SQL Server 2012 表分区

热门文章

  1. mysql:Cannot proceed because system tables used by Event Scheduler were found damaged at server start
  2. sench touch 自定义小图标(转)
  3. .Net Core中的通用主机(二)——托管服务
  4. 更改WebBrowser控件的用户代理
  5. 9款国内外垂直领域的在线作图工具:那些可以替代Visio的应用!【转】
  6. 命令 上传项目到git中
  7. Win10系统的SurfacePro4如何重装系统-2 重装WIN10系统
  8. asp.net mvc 实战化项目之三板斧
  9. cmd命令行的ping用法
  10. Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -