Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

238
Vistas
how to auto change map center to let all markers show in vue-leaflet

just in title,

code is below, i want to change this map center to show all markers,

and the markers will change,so the center is changing,how to calculate the center and zoom in map? thks for answer

<l-map :zoom="amapContext.map.zoom" :center="amapContext.map.center">
          <l-tile-layer
            :url="amapContext.map.url"
            :attribution="amapContext.map.attribution"
          ></l-tile-layer>
          <l-marker
            v-for="(marker, idx) in amapContext.data.markers"
            :key="idx"
            :lat-lng="marker.position"
            :icon="marker.iconShow"
          >
            <l-popup> 经纬度:{{ marker.position }} </l-popup>
          </l-marker>
          <!-- <l-marker :lat-lng="[39.996356, 116.480639]"></l-marker> -->
        </l-map>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

ok, i got a method except it isn't the best solution,

set the map bounds ues two latLngBounds(ref to docs of leaflet) , one latLngBounds is the max lat lng,and the other is min lat lng in markers

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda