动效层:把 beUI 的动效语言移植到两端,令牌放在 packages/shared/src/motion.ts(纯常量,后端也引用得到)。弹簧用数值积分生成 CSS linear(),纯 CSS 即可驱动,不必每组件一个 rAF 循环;两端各一份 composables/motion.ts 负责 DOM 部分,在 app.mount() 之前注入 :root。含 reduced-motion 全局降级与 hover 能力探测;灵动岛只移植单调曲线。
深色主题:Web 管理端补齐,机制与桌面客户端一致;语义色令牌只覆盖颜色,不动圆角与动效令牌。默认跟随系统,用户手动点过之后以用户为准。
图标:build/classhelper.{png,ico} 成为全项目唯一图形源,pnpm icons 从它派生各端图标与界面内品牌标。版本号统一到 1.1.2。
32 lines
1.1 KiB
Vue
32 lines
1.1 KiB
Vue
<script setup lang="ts">
|
|
import { useCountUp } from '@/composables/motion';
|
|
|
|
/**
|
|
* 统计卡片。抽成组件而不是写在 DashboardView 的 v-for 里,是因为数字滚动要用到
|
|
* `useCountUp()` —— 它必须在 setup 阶段调用(内部有 `watch` 与 `onUnmounted`),
|
|
* 而 v-for 里没法给每一项单独跑一遍 setup。
|
|
*
|
|
* 外观类名走全局样式(`styles/index.css` 的 `.stat-card` / `.stat-value`…),
|
|
* 与仪表盘原先的写法完全一致,这里只负责"数字滚起来"。
|
|
*/
|
|
const props = defineProps<{
|
|
label: string;
|
|
value: number;
|
|
hint: string;
|
|
}>();
|
|
|
|
/**
|
|
* 数字滚动(beUI 的 number 原语)。0 → 实际值的那一跳就是它存在的意义:
|
|
* 数据是异步来的,直接跳到终值会让人错过"这一栏有内容"这件事。
|
|
*/
|
|
const displayed = useCountUp(() => props.value);
|
|
</script>
|
|
|
|
<template>
|
|
<div class="stat-card">
|
|
<div class="stat-label">{{ label }}</div>
|
|
<div class="stat-value">{{ Math.round(displayed) }}</div>
|
|
<div class="stat-hint">{{ hint }}</div>
|
|
</div>
|
|
</template>
|