Merge pull request !437 from AhJindeg/N/A
This commit is contained in:
commit
869cae0675
@ -54,7 +54,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<div class="max-h-80 overflow-auto">
|
<div class="max-h-80 overflow-auto">
|
||||||
<ul>
|
<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">
|
<div class="flex items-center">
|
||||||
<span class="text-primary mr-2 font-medium">收到消息:</span>
|
<span class="text-primary mr-2 font-medium">收到消息:</span>
|
||||||
<span>{{ formatDate(msg.time) }}</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 messageList = ref([] as { time: number; text: string }[]) // 消息列表
|
||||||
|
const messageReverseList = computed(() => messageList.value.slice().reverse())
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
if (!data.value) {
|
if (!data.value) {
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user