Browse Source

fix:地图拖动问题

needcode 2 years ago
parent
commit
dafd6a1b9f
1 changed files with 7 additions and 3 deletions
  1. 7 3
      src/pages/map/map.vue

+ 7 - 3
src/pages/map/map.vue

@@ -323,7 +323,7 @@ const refreshStation = (location: any) => {
         height: 34,
       });
     }
-    isIgnoreChangeLocation = true;
+    isIgnoreChangeLocation = markers.value.length !== _markers.length
     stationPage.value.hasNext = res.length >= stationPage.value.pageSize;
     empty.value = stationPage.value.page === 1 ? res.length <= 0 : false;
     station.value =
@@ -469,6 +469,7 @@ const resetLocation = () => {
   });
 };
 const mapUpdated = (e: any) => {
+  // console.log('map updated', isIgnoreChangeLocation)
   setTimeout(() => {
     isIgnoreChangeLocation = false;
   }, 500);
@@ -478,8 +479,11 @@ const mapChange = (e: any) => {
     return;
   }
   if (e.type === "end" && markers.value.length) {
-    // console.log("refreshStation");
-    const { latitude, longitude } = e.detail.centerLocation;
+    console.log("map change end", {
+      ...e.detail.centerLocation
+    });
+    const current = e.target.centerLocation;
+    const { latitude, longitude } = current;
     stationPage.value.page = 1;
     refreshStation({
       latitude,