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