Giter Site home page Giter Site logo

Comments (1)

Uhucream avatar Uhucream commented on June 2, 2024

I resolved this by myself!
But Mapbox GL Language Plugin doesn't correspond the style 'mapbox://styles/mapbox/streets-v11' on master branch at now, so I had to run command that yarn add https://github.com/mapbox/mapbox-gl-language/#streets-11-style .
And it is better to use a way introduced on Mapbox official document that uses setLayerProperty either way because the branch named 'streets-11-style' on Mapbox GL Language Plugin doesn't fully correspond to mapbox://styles/mapbox/streets-11.

The code used Mapbox GL Language Plugin is like below.

<template>
  <MglMap
      :center="center"
      :accessToken="accessToken"
      :mapStyle="mapStyle"
      class="mapPane"
      @load="onMapLoaded"
  >
  </MglMap>
</template>

<script>
import Mapbox from 'mapbox-gl'
import {
  MglMap
} from 'vue-mapbox'

export default {
  ...
  methods: {
    onMapLoaded (event) {
      const map = event.map
      var MapboxLanguage = require('@mapbox/mapbox-gl-language')
      map.addControl(
        new MapboxLanguage(
          defaultLanguage: 'ja'
        )
      )
    }
  }
}
</script>

<style> // It is required for working around for a bug that map is not appeared on web page.
.mapboxgl-canvas {
  outline: transparent;
  left: 0;
}
#map-wrap {
  position: absolute;
  height: 100%;
  top: 0;
  left: 0;
  width: 100%;
  overflow: hidden;
}

#map-wrap .mgl-map-wrapper {
  position: absolute;
  height: 100%;
  top: 0;
  left: 0;
  width: 100%;
}

#map-wrap .mgl-map-wrapper .mapboxgl-map {
  height: 100%;
  left: 0;
  overflow: visible;
  position: absolute;
  top: 0;
  width: 100%;
}
#mapboxgl-ctrl-geolocate {
  display: none;
}
</style>

from vue-mapbox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.