代码优化

master
yezhichao 2021-11-27 12:04:37 +08:00
parent 2812f260d0
commit d0cbf883e7
2 changed files with 5 additions and 16 deletions

View File

@ -43,17 +43,7 @@ const evenRowBGC = '#0A2732'
const header = ['卫星编号', '仰角', '方位角', '载噪比'] const header = ['卫星编号', '仰角', '方位角', '载噪比']
const data = reactive({ const data = reactive({
satellites: [ satellites: []
{id: "20", elevationDeg: 68, azimuthTrue: 322, SNRdB: 25},
{id: "20", elevationDeg: 68, azimuthTrue: 322, SNRdB: 25},
{id: "20", elevationDeg: 68, azimuthTrue: 322, SNRdB: 25},
{id: "20", elevationDeg: 68, azimuthTrue: 322, SNRdB: 25},
{id: "20", elevationDeg: 68, azimuthTrue: 322, SNRdB: 25},
{id: "20", elevationDeg: 68, azimuthTrue: 322, SNRdB: 25},
{id: "20", elevationDeg: 68, azimuthTrue: 322, SNRdB: 25},
{id: "20", elevationDeg: 68, azimuthTrue: 322, SNRdB: 25},
{id: "20", elevationDeg: 68, azimuthTrue: 322, SNRdB: 25},
]
}) })
const update = (GSVArr: Array<any>) => { const update = (GSVArr: Array<any>) => {

View File

@ -71,10 +71,9 @@ onMounted(() => {
const getSatelliteCount = (GSVArr: Array<any>) => { const getSatelliteCount = (GSVArr: Array<any>) => {
if (!GSVArr) return if (!GSVArr) return
let count = 0 const count = GSVArr.reduce((total, gsv) => {
GSVArr.forEach(gsv => { return total + gsv.satellites.length
count += gsv.satellites.length }, 0)
});
return count return count
} }