发送log测试OK
This commit is contained in:
parent
03a61b5989
commit
3408150f84
@ -73,8 +73,8 @@
|
||||
<v-card>{{ currentView }}</v-card>
|
||||
</div>
|
||||
<!-- 日志界面 -->
|
||||
<div v-if="currentView === 'pageLog'" >
|
||||
<LogPage />
|
||||
<div v-show="currentView === 'pageLog'" >
|
||||
<LogPage ref="logRef" />
|
||||
</div>
|
||||
</v-container>
|
||||
</v-main>
|
||||
@ -83,9 +83,12 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { ref, provide } from 'vue';
|
||||
import LogPage from './components/LogPage.vue';
|
||||
|
||||
const logRef = ref(null);
|
||||
provide('logRef', logRef);
|
||||
|
||||
// 使用 ref 定义响应式数据
|
||||
let drawer = ref(true);
|
||||
let currentView = ref("pageCANMsg");
|
||||
|
@ -103,6 +103,7 @@ function updatePagination(value) {
|
||||
}
|
||||
|
||||
const PrintLog = (level, message) => {
|
||||
console.log(`[${level}] ${message}`);
|
||||
const newLog = {
|
||||
timestamp: Date.now(),
|
||||
level: level.toUpperCase(),
|
||||
|
@ -20,12 +20,34 @@
|
||||
</div>
|
||||
</v-col>
|
||||
<v-col cols="4" class="bg-yellow">
|
||||
|
||||
<v-btn
|
||||
@click="handleTestLog"
|
||||
color="primary"
|
||||
class="ma-4"
|
||||
>
|
||||
测试日志
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
inject: ['logRef'],
|
||||
methods: {
|
||||
handleTestLog() {
|
||||
//this.logRef?.PrintLog('INFO', '来自座椅控制页面的测试日志')
|
||||
this.PrintLog('INFO', '来自座椅控制页面的测试日志')
|
||||
alert('测试日志已发送')
|
||||
},
|
||||
PrintLog(level, message) {
|
||||
this.logRef?.PrintLog(level, message)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.background-div {
|
||||
background-image: url("..\assets\座椅.png");
|
||||
|
Loading…
x
Reference in New Issue
Block a user