update src/views/infra/webSocket/index.vue. #434

Signed-off-by: AhJindeg <ahjindeg@gmail.com>
This commit is contained in:
AhJindeg 2024-04-30 08:50:55 +00:00 committed by Gitee
parent 730da857e1
commit de967a0160
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -54,7 +54,7 @@
</template>
<div class="max-h-80 overflow-auto">
<ul>
<li v-for="msg in messageList.reverse()" :key="msg.time" class="mt-2">
<li v-for="msg in messageReverseList" :key="msg.time" class="mt-2">
<div class="flex items-center">
<span class="text-primary mr-2 font-medium">收到消息:</span>
<span>{{ formatDate(msg.time) }}</span>
@ -92,6 +92,7 @@ const { status, data, send, close, open } = useWebSocket(server.value, {
/** 监听接收到的数据 */
const messageList = ref([] as { time: number; text: string }[]) //
const messageReverseList = computed(() => messageList.value.slice().reverse())
watchEffect(() => {
if (!data.value) {
return