Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Language change #14

Open
AlxZb opened this issue May 7, 2020 · 4 comments
Open

Language change #14

AlxZb opened this issue May 7, 2020 · 4 comments

Comments

@AlxZb
Copy link

AlxZb commented May 7, 2020

Hi! 2 questions:

  1. How to pass the lang to map?
  2. If I want to change the lang from a form element, how would it be?

Thanks!

@krokodilshnap
Copy link

Please add a language prop to module options! 😭

@sarkhanrajabov
Copy link

How do you import component to the template? Please share code with me :)

@krokodilshnap
Copy link

Just add this to nuxt.config.js

['nuxt-google-maps-module', {
      /* module options */
      key: 'AIzaSyAlOasR7KJ5J851eCdjxgI0_bs6p_6HTMk&language=en', // you can change language here
      libraries: ['places', 'geometry'] // additional libraries
    }]

Then in your component you can write like this:

<template>
  <div ref="map"></div>
</template>
export default {
data() {
  return {
    map: '',
    minZoom: 4,
    zoom: 10,
    center: {lat: 54, lng: 30}
  }
},
mounted() {
if (process.browser) {
        window.addEventListener('maps-module:loaded', () => {
this.map = new this.$google.maps.Map(this.$refs.map, { // ref to element in template
          center: this.center,
          zoom: this.zoom,
          minZoom: this.minZoom, 
          styles: this.mapStyle, // can use your custom map styles
        });
});
      }
}
}

@Quineone
Copy link

Quineone commented Apr 7, 2021

Please add a language prop to module options! 😭

Yes, had better add.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants