<div id="app">
  <l-map :bounds="bounds" style="position: absolute; top: 0;right: 0; bottom: 0; left: 0;">
    <l-tile-layer :url="tileurl"></l-tile-layer>
    <l-marker v-for="item in items" :lat-lng="{lat: item.lat, lon: item.long }">
      <l-popup>
        <a :href="item.url" target="_blank" rel="noreferrer noopener">
          {{ item.label }}
        </a>
      </l-popup>
    </l-marker>
  </l-map>
</div>
Vue.component("l-map", window.Vue2Leaflet.LMap);
Vue.component("l-tile-layer", window.Vue2Leaflet.LTileLayer);
Vue.component("l-marker", window.Vue2Leaflet.LMarker);
Vue.component("l-popup", window.Vue2Leaflet.LPopup);
new Vue({
  el: "#app",
  data() {
    return {
      items: [],
      tileurl: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
      bounds: null
    };
  },
  mounted() {
    var self = this;
    axios
      .post("https://uedayou.net/loa/search", {
        query: `query PlaceList($query: String!, $type: String!) {
              searchPlaces(address: $query, type: $type) {
                label
                address
                url
                geohash
                type
              }
            }`,
        variables: {
          query: "東京都千代田区有楽町",
          type: "ALL"
        }
      })
      .then(function (response) {
        self.items = response.data.data.searchPlaces;
        self.items.forEach(function (item) {
          var coord = geohash.decode(item.geohash);
          item.lat = coord.latitude;
          item.long = coord.longitude;
          self.setBounds(item.lat, item.long);
        });
      })
      .catch(function (error) {
        console.log(error);
      });
  },
  methods: {
    setBounds: function (lat, long) {
      if (!this.bounds)
        this.bounds = [
          [lat, long],
          [lat, long]
        ];
      if (this.bounds[1][0] > lat) this.bounds[1][0] = lat;
      if (this.bounds[0][0] < lat) this.bounds[0][0] = lat;
      if (this.bounds[1][1] > long) this.bounds[1][1] = long;
      if (this.bounds[0][1] < long) this.bounds[0][1] = long;
    }
  }
});

External CSS

  1. https://unpkg.com/leaflet/dist/leaflet.css

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.11/vue.min.js
  2. https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.js
  3. https://cdnjs.cloudflare.com/ajax/libs/Vue2Leaflet/2.7.1/vue2-leaflet.min.js
  4. https://cdnjs.cloudflare.com/ajax/libs/axios/0.21.1/axios.min.js
  5. https://cdn.jsdelivr.net/npm/@alexpavlov/geohash-js