其他常用模块
# 1 日期处理- moment
- 安装moment
yarn add moment
1
- 引入moment
import moment from 'moment'
1
- 定义格式化时间的函数
methods: {
// 格式化时间
formatDate(input) {
return moment(input).format('YYYY-MM-DD HH:mm:ss')
}
}
1
2
3
4
5
6
2
3
4
5
6
- 页面中格式化使用
<td>{{ formatDate(item.date) }}</td>
1
上次更新: 2025/04/03, 11:07:08