Vibe Coding Wallpaper
开始体验
全部场景
前端热更新

前端实时预览

pulse-dashboardfeat/live-metrics
PROMPT · 0%
智能体推理
理解视觉目标卡片需要实时更新,同时不能让网格抖动或重新挂载。
LiveDashboard.vueuseLiveMetrics.ts

1<script setup lang="ts">

2import { computed } from 'vue'

3import { Activity, ArrowUpRight, Users } from 'lucide-vue-next'

4import { useLiveMetrics } from '@/composables/useLiveMetrics'

5

6const props = defineProps<{ projectId: string }>()

7const { metrics, status } = useLiveMetrics(props.projectId)

8

9const cards = computed(() => [

10 { label: 'Active users', value: metrics.value.activeUsers, icon: Users },

11 { label: 'Events / min', value: metrics.value.eventsPerMinute, icon: Activity },

12])

13</script>

14

15<template>

16 <section class="dashboard-grid">

17 <article v-for="card in cards" :key="card.label" class="metric-card">

18 <component :is="card.icon" :size="18" />

19 <span>{{ card.label }}</span>

20 <strong>{{ card.value.toLocaleString() }}</strong>

21 <small><ArrowUpRight :size="13" /> live</small>

22 </article>

23 </section>

24 <footer :data-status="status">Updated from the live stream</footer>

25</template>

pnpm dev ready in 412ms
localhost:3000/dashboard
OVERVIEW

Live metrics

LIVE
Active users↗ 12.4% this hour
Events / min↗ streaming now
Realtime activityLast 30 min
关于此场景

前端实时预览

Vue 仪表盘与浏览器实时预览同步演进,组件、响应式状态、测试与热更新保持联动。

适合深度工作、直播背景,也适合静静看着软件逐步成形。

Vue实时预览响应式界面