diff --git a/src/components/dashboard/MessageStream.vue b/src/components/dashboard/MessageStream.vue index dd74044..13959c9 100644 --- a/src/components/dashboard/MessageStream.vue +++ b/src/components/dashboard/MessageStream.vue @@ -14,7 +14,7 @@ const emit = defineEmits<{ const scrollRef = ref(null) const autoScroll = ref(true) -const expandedPayloads = ref(new Set()) +const collapsedPayloads = ref(new Set()) const messageFormats = ref>({}) const formatOptions: { value: string; label: string }[] = [ @@ -83,10 +83,10 @@ function setFormat(msgId: string, fmt: 'auto' | 'json' | 'hex' | 'base64' | 'pla } function togglePayload(msgId: string) { - const s = new Set(expandedPayloads.value) + const s = new Set(collapsedPayloads.value) if (s.has(msgId)) s.delete(msgId) else s.add(msgId) - expandedPayloads.value = s + collapsedPayloads.value = s } // ─── Display helpers ─────────────────────────────────────────── @@ -156,17 +156,17 @@ function formatTime(ts: number): string { @click="togglePayload(msg.id)" > - + - {{ expandedPayloads.has(msg.id) ? '收起' : '展开' }} + {{ !collapsedPayloads.has(msg.id) ? '收起' : '展开' }} -
+
{{ formatPayload(msg) }}
{{ truncate(prettyJson(msg.payload), 200) }}