Commit 4fe4c6ef by yuzhenWang

Merge branch 'wyz' into 'test'

优化发测试

See merge request !4
parents 5edcb151 5c0a6668
...@@ -3,8 +3,8 @@ import { computed, onMounted, ref } from 'vue' ...@@ -3,8 +3,8 @@ import { computed, onMounted, ref } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import ApiLoader from '@/components/common/ApiLoader.vue' import ApiLoader from '@/components/common/ApiLoader.vue'
import MetricCard from '@/components/feature/MetricCard.vue' import MetricCard from '@/components/feature/MetricCard.vue'
import TodoCard from '@/components/feature/TodoCard.vue' // import TodoCard from '@/components/feature/TodoCard.vue'
import { fetchMetricSummary, fetchTodos, todoDataSource } from '@/api/modules/dashboard' import { fetchMetricSummary, fetchTodos } from '@/api/modules/dashboard'
import type { MetricSummary, TodoItem, TodoType } from '@/api/types' import type { MetricSummary, TodoItem, TodoType } from '@/api/types'
import { formatHkd } from '@/utils/money' import { formatHkd } from '@/utils/money'
...@@ -32,16 +32,16 @@ const restCards = computed<RestCard[]>(() => { ...@@ -32,16 +32,16 @@ const restCards = computed<RestCard[]>(() => {
] ]
}) })
// 一次遍历统计,原实现为三次 filter(每类各扫一遍) // // 一次遍历统计,原实现为三次 filter(每类各扫一遍)
const countByType = computed(() => // const countByType = computed(() =>
todos.value.reduce( // todos.value.reduce(
(acc, todo) => { // (acc, todo) => {
acc[todo.type] += 1 // acc[todo.type] += 1
return acc // return acc
}, // },
{ renewal: 0, lapse: 0, birthday: 0 } as Record<TodoType, number> // { renewal: 0, lapse: 0, birthday: 0 } as Record<TodoType, number>
) // )
) // )
async function load() { async function load() {
loading.value = true 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