Files
Message-Push-Nest/web/src/components/pages/dashboard/CardNum.vue
T

42 lines
1.1 KiB
Vue
Raw Normal View History

2025-08-10 14:32:24 +08:00
<template>
2025-09-28 21:22:05 +08:00
<Card class="w-full cursor-pointer hover:shadow-md transition-shadow duration-200" @click="handleClick">
2025-08-10 14:32:24 +08:00
<CardHeader class="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle class="text-sm font-medium text-muted-foreground">
{{ title }}
</CardTitle>
<component :is="icon" class="h-5 w-5 text-muted-foreground" />
</CardHeader>
<CardContent>
<div class="text-2xl font-bold">{{ value }}</div>
<p class="text-xs text-muted-foreground">{{ description }}</p>
</CardContent>
</Card>
</template>
<script setup lang="ts">
import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card"
import type { Component } from 'vue'
2025-09-28 21:22:05 +08:00
import { useRouter } from 'vue-router'
2025-08-10 14:32:24 +08:00
2025-09-28 21:22:05 +08:00
const router = useRouter()
const props = defineProps<{
2025-08-10 14:32:24 +08:00
title: string
value: string | number
description?: string
icon?: Component
2025-09-28 21:22:05 +08:00
routePath?: string
2025-08-10 14:32:24 +08:00
}>()
2025-09-28 21:22:05 +08:00
const handleClick = () => {
if (props.routePath) {
router.push(props.routePath)
}
}
2025-08-10 14:32:24 +08:00
</script>
<script lang="ts">
export default {
name: 'CardNum'
}
</script>