fix journal detail sort
This commit is contained in:
@ -143,7 +143,7 @@ Page({
|
|||||||
}) || [];
|
}) || [];
|
||||||
|
|
||||||
// 转换为 JournalInfo 格式
|
// 转换为 JournalInfo 格式
|
||||||
const journals: JournalInfo[] = list.map((journal: any) => {
|
const journals: JournalInfo[] = list.sort((a, b) => a.createdAt! - b.createdAt!).map((journal: any) => {
|
||||||
const date = new Date(journal.createdAt);
|
const date = new Date(journal.createdAt);
|
||||||
return {
|
return {
|
||||||
id: journal.id,
|
id: journal.id,
|
||||||
@ -165,9 +165,6 @@ Page({
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// 按 id 倒序排序
|
|
||||||
journals.sort((a, b) => b.id - a.id);
|
|
||||||
|
|
||||||
this.setData({
|
this.setData({
|
||||||
selectedDate: {
|
selectedDate: {
|
||||||
displayDate,
|
displayDate,
|
||||||
|
|||||||
Reference in New Issue
Block a user