实现海拔高度数据的更新

master
yezhichao 2021-11-23 07:54:17 +08:00
parent bad94bd96e
commit ce6dc0b882
4 changed files with 15 additions and 20 deletions

View File

@ -6,7 +6,7 @@
<script lang="ts" setup> <script lang="ts" setup>
const props = defineProps({ const props = defineProps({
value: Number || String, value: String,
style: String style: String
}) })
</script> </script>

View File

@ -11,7 +11,6 @@
:style="item.style" :style="item.style"
:ref="item.key + 'Digital'" :ref="item.key + 'Digital'"
/> />
<div class="unit ml-2.5 leading-10">{{ item.unit }}</div>
</div> </div>
</div> </div>
</div> </div>
@ -25,33 +24,27 @@ const digitalFlopData = reactive([
{ {
title: '日  期', title: '日  期',
value: '', value: '',
style: 'color: #4d99fc', style: 'color: #4d99fc'
unit : ''
}, { }, {
title: '时  间', title: '时  间',
value: '', value: '',
style: 'color: #f46827', style: 'color: #f46827'
unit : ''
}, { }, {
title: '经  度', title: '经  度',
value: '', value: '',
style: 'color: #40faee', style: 'color: #40faee'
unit : ''
}, { }, {
title: '纬  度', title: '纬  度',
value: '', value: '',
style: 'color: #4d99fc', style: 'color: #4d99fc'
unit : ''
}, { }, {
title: '海  拔', title: '海  拔',
value: null, value: '',
style: 'color: #f46827', style: 'color: #f46827'
unit : ''
}, { }, {
title: '定位卫星数目', title: '定位卫星数目',
value: 0, value: '',
style: 'color: #40faee', style: 'color: #40faee'
unit : ''
} }
]) ])
@ -72,7 +65,7 @@ const update = (
// //
digitalFlopData[4].value = `${alt}` digitalFlopData[4].value = `${alt}`
// //
digitalFlopData[5].value = numSat digitalFlopData[5].value = numSat.toString()
} }
defineExpose({ update }) defineExpose({ update })

View File

@ -29,13 +29,15 @@ const option = reactive({
}, },
label: { label: {
formatter: function({ value }) { formatter: function({ value }) {
return value return parseInt(value)
} }
}, },
data: [60, 0.5, 0.4, 0.3] data: [60, 0.5, 0.4, 0.3]
}] }]
}) })
const update = console.log const update = (alt: number) => {
option.series[0].data[0] = alt
}
defineExpose({ update }) defineExpose({ update })
</script> </script>

View File

@ -51,7 +51,7 @@ const update = (nmeaStr: string) => {
digitalFlopContainer.value.update(dateTime, longitude, latitude, alt, numSat) digitalFlopContainer.value.update(dateTime, longitude, latitude, alt, numSat)
clock.value.update(dateTime) clock.value.update(dateTime)
compass.value.update(variation, variationPole) compass.value.update(variation, variationPole)
// waterLevel.value.update(alt) waterLevel.value.update(alt)
// map.value.update(lon, lonPole, lat, latPole) // map.value.update(lon, lonPole, lat, latPole)
} }