Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

234
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!