Skip to content

Commit f4413e9

Browse files
committed
feat(App): 对任务日期进行排序
- 在 App.vue 文件中,对任务按日期进行降序排序 - 使用 Object.keys() 和 sort() 方法实现排序 - 确保最新的任务日期显示在最前面
1 parent cf22b29 commit f4413e9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/App.vue

+9-1
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,15 @@ export default {
487487
return acc;
488488
}, {});
489489
490-
return blocks;
490+
// 对日期进行排序,最新的日期在前面
491+
const sortedBlocks = {};
492+
Object.keys(blocks)
493+
.sort((a, b) => new Date(b) - new Date(a))
494+
.forEach(key => {
495+
sortedBlocks[key] = blocks[key];
496+
});
497+
498+
return sortedBlocks;
491499
},
492500
onTaskSelected(task) {
493501
console.log('Selected task:', task);

0 commit comments

Comments
 (0)