mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-17 16:24:25 +08:00
allow users to set coordinate display type (#141)
This commit is contained in:
@@ -39,20 +39,20 @@ import MapView from '@/components/common/MapView.vue';
|
||||
|
||||
import { useI18n } from '@/locales/helpers.ts';
|
||||
|
||||
import type { MapPosition } from '@/core/map.ts';
|
||||
import type { Coordinate } from '@/core/coordinate.ts';
|
||||
|
||||
import { isSupportGetGeoLocationByClick } from '@/lib/map/index.ts';
|
||||
|
||||
type MapViewType = InstanceType<typeof MapView>;
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue?: MapPosition;
|
||||
modelValue?: Coordinate;
|
||||
setGeoLocationByClickMap?: boolean;
|
||||
show: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:modelValue', value: MapPosition | undefined): void;
|
||||
(e: 'update:modelValue', value: Coordinate | undefined): void;
|
||||
(e: 'update:setGeoLocationByClickMap', value: boolean): void;
|
||||
(e: 'update:show', value: boolean): void;
|
||||
}>();
|
||||
@@ -61,7 +61,7 @@ const { tt } = useI18n();
|
||||
|
||||
const map = useTemplateRef<MapViewType>('map');
|
||||
|
||||
const geoLocation = computed<MapPosition | undefined>({
|
||||
const geoLocation = computed<Coordinate | undefined>({
|
||||
get: () => {
|
||||
return props.modelValue;
|
||||
},
|
||||
@@ -70,10 +70,10 @@ const geoLocation = computed<MapPosition | undefined>({
|
||||
}
|
||||
});
|
||||
|
||||
function updateSpecifiedGeoLocation(mapPosition: MapPosition): void {
|
||||
function updateSpecifiedGeoLocation(coordinate: Coordinate): void {
|
||||
if (isSupportGetGeoLocationByClick() && props.setGeoLocationByClickMap) {
|
||||
geoLocation.value = mapPosition;
|
||||
map.value?.setMarkerPosition(mapPosition);
|
||||
geoLocation.value = coordinate;
|
||||
map.value?.setMarkerPosition(coordinate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user