|
@@ -77,6 +77,7 @@ import {
|
|
|
import { BasemapInfo, SearchResultItem, SelectMapImageProps } from "../index";
|
|
|
import html2canvas from "html2canvas";
|
|
|
import { ElInput, ElSelect, ElOption } from "element-plus";
|
|
|
+import { asyncTimeout } from "@/utils/shared";
|
|
|
|
|
|
const props = defineProps<SelectMapImageProps>();
|
|
|
|
|
@@ -96,10 +97,10 @@ const tiles = computed(() => props.tileGroups[groupIndex.value].tiles);
|
|
|
watchEffect(() => setTileLayers(tiles.value));
|
|
|
|
|
|
const searchTypes = [
|
|
|
- { label: "经纬度", value: "latlng" },
|
|
|
{ label: "地址", value: "name" },
|
|
|
+ { label: "经纬度", value: "latlng" },
|
|
|
];
|
|
|
-const searchType = ref(searchTypes[0].value as "latlng" | "name");
|
|
|
+const searchType = ref(searchTypes[1].value as "latlng" | "name");
|
|
|
const searchName = computed(
|
|
|
() => searchTypes.find((item) => item.value === searchType.value)!.label
|
|
|
);
|
|
@@ -142,13 +143,18 @@ const searchHandler = async () => {
|
|
|
};
|
|
|
|
|
|
const initLatlng = async () => {
|
|
|
- let latlng: LatLng = window.platform.getDefaultAddress() || (await getCurrentLatlng());
|
|
|
- if (!keyword.value && mark.value === undefined && searchType.value === "latlng") {
|
|
|
- keyword.value = `${latlng.lat},${latlng.lng}`;
|
|
|
- searchHandler();
|
|
|
+ try {
|
|
|
+ let latlng: LatLng =
|
|
|
+ window.platform.getDefaultAddress() || (await getCurrentLatlng());
|
|
|
+ if (!keyword.value && mark.value === undefined && searchType.value === "latlng") {
|
|
|
+ keyword.value = `${latlng.lat},${latlng.lng}`;
|
|
|
+ searchHandler();
|
|
|
+ }
|
|
|
+ } finally {
|
|
|
+ await asyncTimeout(160);
|
|
|
+ // await nextTick();
|
|
|
+ searchType.value = "name";
|
|
|
}
|
|
|
- await nextTick();
|
|
|
- searchType.value = "name";
|
|
|
};
|
|
|
initLatlng();
|
|
|
|