fix: 修复硬件信息undefined

This commit is contained in:
feng
2023-03-09 17:15:35 +08:00
parent 80145dc114
commit 3b83ecd85d

View File

@@ -54,7 +54,14 @@ export default {
const memory = this.items['memory']
const diskTotal = this.items['disk_total']
if (cpuCount) {
return `${cpuVcpus || cpuCores * cpuCount} Core ${memory}G ${diskTotal}G`
let text = `${cpuVcpus || cpuCores * cpuCount} Core`
if (memory) {
text += ` ${memory}G`
}
if (diskTotal) {
text += ` ${diskTotal}G`
}
return text
}
return '-'
}