首页 > 其他分享 >公共方法1,时间处理

公共方法1,时间处理

时间:2022-10-18 15:47:18浏览次数:68  
标签:格式化 处理 公共 moment formatTime time 时间 方法

目标:通过moment对时间进行格式化

步骤:

  1. 安装moment:yarn add moment

  2. 使用moment进行格式化

核心代码:

formatTime(time) {
 return moment(time).format('YYYY-MM-DD HH:mm:ss')
}

<span className="time">{this.formatTime(item.time)}</span>
 

标签:格式化,处理,公共,moment,formatTime,time,时间,方法
From: https://www.cnblogs.com/hxy--Tina/p/16802764.html

相关文章