wenhongquan 3 年之前
父节点
当前提交
cf4943974d
共有 1 个文件被更改,包括 13 次插入1 次删除
  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) {