Commit 5c0a6668 by yuzhenWang

优化发测试

parent ebee16ee
......@@ -3,8 +3,8 @@ import { computed, onMounted, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import ApiLoader from '@/components/common/ApiLoader.vue'
import MetricCard from '@/components/feature/MetricCard.vue'
import TodoCard from '@/components/feature/TodoCard.vue'
import { fetchMetricSummary, fetchTodos, todoDataSource } from '@/api/modules/dashboard'
// import TodoCard from '@/components/feature/TodoCard.vue'
import { fetchMetricSummary, fetchTodos } from '@/api/modules/dashboard'
import type { MetricSummary, TodoItem, TodoType } from '@/api/types'
import { formatHkd } from '@/utils/money'
......@@ -32,16 +32,16 @@ const restCards = computed<RestCard[]>(() => {
]
})
// 一次遍历统计,原实现为三次 filter(每类各扫一遍)
const countByType = computed(() =>
todos.value.reduce(
(acc, todo) => {
acc[todo.type] += 1
return acc
},
{ renewal: 0, lapse: 0, birthday: 0 } as Record<TodoType, number>
)
)
// // 一次遍历统计,原实现为三次 filter(每类各扫一遍)
// const countByType = computed(() =>
// todos.value.reduce(
// (acc, todo) => {
// acc[todo.type] += 1
// return acc
// },
// { renewal: 0, lapse: 0, birthday: 0 } as Record<TodoType, number>
// )
// )
async function load() {
loading.value = true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment