fixed a lot of details in the docs to make it better

This commit is contained in:
NathanAP
2022-10-18 09:21:56 -03:00
parent 749a090b5f
commit e81b96471f
22 changed files with 15548 additions and 886 deletions

View File

@@ -1,14 +1,12 @@
# How to access Google Maps object.
[Interactive example on Condesandbox](https://stackblitz.com/edit/vue-google-maps-marker-khyhfk?file=src/components/ComponentWithMap.vue)
# How to access Google Maps object
[Interactive example on CodeSandbox](https://stackblitz.com/edit/vue-google-maps-marker-khyhfk?file=src/components/ComponentWithMap.vue)
To access Google maps object, or do something when map is loaded, use a ref on the `GMapMap` object.
## Example
```bash
```html
<template>
<GMapMap
:center="center"
@@ -31,51 +29,49 @@ To access Google maps object, or do something when map is loaded, use a ref on t
</template>
<script>
export default {
mounted() {
this.$refs.myMapRef.$mapPromise.then((mapObject) => {
console.log('map is loaded now', mapObject);
});
},
data() {
return {
center: { lat: 51.093048, lng: 6.84212 },
markers: [
{
position: {
lat: 51.093048,
lng: 6.84212,
export default {
mounted() {
this.$refs.myMapRef.$mapPromise.then((mapObject) => {
console.log('map is loaded now', mapObject)
})
},
data() {
return {
center: { lat: 51.093048, lng: 6.84212 },
markers: [
{
position: {
lat: 51.093048,
lng: 6.84212,
},
},
},
{
position: {
lat: 51.198429,
lng: 6.69529,
{
position: {
lat: 51.198429,
lng: 6.69529,
},
},
},
{
position: {
lat: 51.165218,
lng: 7.067116,
{
position: {
lat: 51.165218,
lng: 7.067116,
},
},
},
{
position: {
lat: 51.09256,
lng: 6.84074,
{
position: {
lat: 51.09256,
lng: 6.84074,
},
},
},
],
};
},
};
],
}
},
}
</script>
<style>
body {
margin: 0;
}
body {
margin: 0;
}
</style>
```