调整
This commit is contained in:
parent
1250cfb173
commit
3f8f6d5e81
@ -1,14 +1,18 @@
|
||||
import {GetCpuUsage, GetNetworkCounter, GetVirtualMemory} from "frontend/wailsjs/go/system/InfoUtils";
|
||||
import {GetCpuInfo, GetCpuUsage, GetNetworkCounter, GetVirtualMemory} from "frontend/wailsjs/go/system/InfoUtils";
|
||||
import {computed, reactive, ref, watch} from "vue";
|
||||
import {asyncComputed} from "@vueuse/core";
|
||||
import {bytesToSizeWithUnit} from "src/utils/file/file";
|
||||
import {cpu as CPU} from "frontend/wailsjs/go/models";
|
||||
import InfoStat = CPU.InfoStat;
|
||||
|
||||
let cpu = reactive({
|
||||
info: <InfoStat>{
|
||||
modelName: ""
|
||||
},
|
||||
usage: {
|
||||
data: <number[]>[],
|
||||
interval: <NodeJS.Timeout | undefined>undefined
|
||||
},
|
||||
|
||||
})
|
||||
|
||||
export function useCpuUsage(){
|
||||
@ -24,3 +28,11 @@ export function useCpuUsage(){
|
||||
loop()
|
||||
return computed(()=>cpu.usage.data)
|
||||
}
|
||||
|
||||
export function useCpuInfo(){
|
||||
GetCpuInfo().then(result=>{
|
||||
Object.assign(cpu.info,result[0] || {})
|
||||
})
|
||||
|
||||
return cpu.info
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ import MemoryUsageChart from "src/components/system/memory/MemoryUsageChart.vue"
|
||||
import NetworkCounter from "src/components/system/network/NetworkCounter.vue";
|
||||
import NetworkSumRateChart from "src/components/system/network/NetworkSumRateChart.vue"
|
||||
import NetworkSumMaxRate from "src/components/system/network/NetworkSumMaxRate.vue";
|
||||
import {useCpuInfo} from "src/utils/system/cpu";
|
||||
function switchLocale(){
|
||||
console.log(globalConfigState.ui.value.locale)
|
||||
if(globalConfigState.ui.value.locale.name === 'zh-cn'){
|
||||
@ -96,13 +97,19 @@ const generateData = (
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
const cpuInfo = useCpuInfo()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
<el-row>
|
||||
<el-col :md="4" :sm="12">
|
||||
<CPUUsage/>
|
||||
<CPUUsage>
|
||||
<template #footer>
|
||||
<div class="text-sm">{{cpuInfo.modelName}}</div>
|
||||
</template>
|
||||
</CPUUsage>
|
||||
</el-col>
|
||||
<el-col :md="4" :sm="12">
|
||||
<MemoryUsage>
|
||||
|
Loading…
Reference in New Issue
Block a user