From 79a7c2707011902ec4df62ed8a285fa2029a1782 Mon Sep 17 00:00:00 2001 From: 刘磊 <1161824510@qq.com> Date: 星期二, 24 十二月 2024 10:09:23 +0800 Subject: [PATCH] 1 --- Code Management/WCS/WIDESEAWCS_Client/src/views/Home.vue | 39 ++++++++++++++++++++++++++++++--------- 1 files changed, 30 insertions(+), 9 deletions(-) diff --git a/Code Management/WCS/WIDESEAWCS_Client/src/views/Home.vue b/Code Management/WCS/WIDESEAWCS_Client/src/views/Home.vue index 2d83b3c..134ace2 100644 --- a/Code Management/WCS/WIDESEAWCS_Client/src/views/Home.vue +++ b/Code Management/WCS/WIDESEAWCS_Client/src/views/Home.vue @@ -1,21 +1,38 @@ <template> <div class="title"></div> + <el-container> + <el-header>鏃ュ織</el-header> + <el-main> + <el-card v-for="(log, index) in logs" :key="index" class="log-card" :style="{ color: log.color }"> + <div :style="{ color: log.color }">{{ log.logEntry }}</div> + <div :style="{ color: log.color }">{{ log.time }}</div> + </el-card> + </el-main> + </el-container> </template> <script> -import { ref, reactive } from 'vue' -import eventBus from "../uitils/eventBus"; +import { ref, onMounted } from 'vue' +import eventBus from "@/uitils/eventBus"; + export default { setup() { + const logs = ref([]); + onMounted(() => { + eventBus.on('Logs', eventData => { + if (logs.value.length > 500) { + logs.value = []; + } + const logEntry = "鏃ュ織淇℃伅锛�" + eventData.log + const time = "鏃堕棿锛�" + eventData.time + logs.value.unshift({ logEntry: logEntry, time: time, color: eventData.color }); + + // logs.value.unshift(logEntry); + }); + }); return { + logs } - - eventBus.on('stackerData', eventData => { - console.log(eventData); - }) - eventBus.on('locationData', eventData => { - console.log(eventData); - }) } } </script> @@ -27,4 +44,8 @@ font-size: 28px; color: orange; } + +.log-card { + margin-bottom: 10px; +} </style> \ No newline at end of file -- Gitblit v1.9.3