flat: 暂存

This commit is contained in:
史典卓
2025-05-13 11:10:38 +08:00
parent 582e432e6a
commit fd74b7d4df
109 changed files with 8644 additions and 5205 deletions

View File

@@ -1,15 +1,17 @@
<template>
<span style="padding-left: 16rpx">{{ tofixedAndKmM(distance) }}</span>
<span style="padding-left: 16rpx">{{ distance }}</span>
</template>
<script setup>
import { inject } from 'vue';
import { inject, computed, watch } from 'vue';
const { haversine, getDistanceFromLatLonInKm } = inject('globalFunction');
const { alat, along, blat, blong } = defineProps(['alat', 'along', 'blat', 'blong']);
const distance = getDistanceFromLatLonInKm(alat, along, blat, blong);
function tofixedAndKmM(data) {
const { km, m } = data;
if (!alat && !along) {
const props = defineProps(['alat', 'along', 'blat', 'blong']);
const distance = computed(() => {
const distance2 = getDistanceFromLatLonInKm(props.alat, props.along, props.blat, props.blong);
// console.log(distance2, props.alat, props.along, props.blat, props.blong);
const { km, m } = distance2;
if (!props.alat && !props.along) {
return '--km';
}
if (km > 1) {
@@ -17,7 +19,8 @@ function tofixedAndKmM(data) {
} else {
return m.toFixed(2) + 'm';
}
}
return '';
});
</script>
<style></style>