
vue formatDate函数封装
// date: 给定的时间戳
// fmt: 期望的输出格式
export function formatDate(date, fmt) {
// 处理年份
// 正则y+ 匹配一个或多个y
if (/(y+)/.test(fmt)) {
// 使用.replace() 替换 RegExp.$1 匹配到的值为 date.getFullYear
// .substr() 截取 RegExp.$1 匹配到的 长度
// 例如:通过/(y+).test(fmt)匹配到Reg.




