wenhongquan 3 years ago
parent
commit
cf4943974d
1 changed files with 13 additions and 1 deletions
  1. 13 1
      src/components/MarkerMap/index.tsx

+ 13 - 1
src/components/MarkerMap/index.tsx

@@ -921,7 +921,19 @@ export default defineComponent({
 
       
       handleFitBounds();
-      state.map?.setZoom(11);
+      
+      try {
+        state.map?.setZoom(11);
+        state.map?.setCenter({
+          lng: parseFloat(markers[0].locations?.split(',')[0] ?? '0'),
+          lat: parseFloat(markers[0].locations?.split(',')[1] ?? '0'),
+        });
+        
+      } catch (E) { 
+
+      }
+      
+
     };
     const handleFitBounds = () => {
       if (state.positions.length === 0) {