日志按时间戳正序排序

This commit is contained in:
xlsea 2024-01-22 10:02:56 +08:00
parent fa9f64d28b
commit d9608d5bd6

View File

@ -135,6 +135,7 @@ export default {
this.fromIndex = res.data.fromIndex this.fromIndex = res.data.fromIndex
if (res.data.message) { if (res.data.message) {
this.logList.push(...res.data.message) this.logList.push(...res.data.message)
this.logList.sort((a, b) => a.time_stamp - b.time_stamp)
} }
}) })
.catch(() => { .catch(() => {
@ -153,7 +154,7 @@ export default {
const hours = date.getHours() const hours = date.getHours()
const minutes = date.getMinutes().toString().length === 1 ? '0' + date.getMinutes() : date.getMinutes().toString() const minutes = date.getMinutes().toString().length === 1 ? '0' + date.getMinutes() : date.getMinutes().toString()
const seconds = date.getSeconds().toString().length === 1 ? '0' + date.getSeconds() : date.getSeconds().toString() const seconds = date.getSeconds().toString().length === 1 ? '0' + date.getSeconds() : date.getSeconds().toString()
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}` return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}.${date.getMilliseconds()}`
} }
} }
} }