Improve docs for markers
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
This is the base Map component. If no props are provided, it shows an empty map component with default controls.
|
This is the base Map component. If no props are provided, it shows an empty map component with default controls.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
<GoogleMap />
|
<GoogleMap />
|
||||||
@@ -19,7 +19,7 @@ You can generate custom map styles at [https://mapstyle.withgoogle.com/](https:
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Disable ui elements
|
## Disable ui elements
|
||||||
You can disable all ui components at once
|
You can disable all ui components at once
|
||||||
```javascript
|
```javascript
|
||||||
<GoogleMap
|
<GoogleMap
|
||||||
:disableDefaultUI="true"
|
:disableDefaultUI="true"
|
||||||
@@ -42,7 +42,7 @@ You can also disable specific UI components
|
|||||||
|
|
||||||
|
|
||||||
## Access google maps instance
|
## Access google maps instance
|
||||||
You can easily access Map instance by injecting it in your component.
|
You can easily access Map instance by injecting it in your component.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const loadMap = inject(
|
const loadMap = inject(
|
||||||
@@ -74,4 +74,4 @@ export function addMyButton(map) {
|
|||||||
|
|
||||||
map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(controlDiv); // eslint-disable-line no-undef
|
map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(controlDiv); // eslint-disable-line no-undef
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,34 +1,49 @@
|
|||||||
# Marker
|
# Marker
|
||||||
|
|
||||||
## Install
|
With a marker, you can show specific locations on the map
|
||||||
|
|
||||||
With marker you can show specific locations on the map
|
|
||||||
```vue
|
```vue
|
||||||
<GoogleMap>
|
<template>
|
||||||
<Marker
|
<GmapMap>
|
||||||
:geoCoordinates="[
|
<GmapMarker
|
||||||
{
|
:key="index"
|
||||||
lat: 51.2432981,
|
v-for="(m, index) in markers"
|
||||||
lng: 6.7950981
|
|
||||||
}
|
|
||||||
]"
|
|
||||||
/>
|
/>
|
||||||
</GoogleMap>
|
</GmapMap>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'App',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
markers: [
|
||||||
|
{
|
||||||
|
position: {
|
||||||
|
lat: 51.093048, lng: 6.842120
|
||||||
|
},
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Center markers automatically
|
## Enable/Disable events
|
||||||
To center markers so that all the markers are visible, use:
|
You can enable or disable map events by passing props.
|
||||||
|
|
||||||
```vue
|
```vue
|
||||||
<GoogleMap
|
<template>
|
||||||
:centerGeoCoordinates="geoCoordinates">
|
<GmapMap
|
||||||
<Marker
|
ref="myMarker"
|
||||||
:centerAutomatically="false"
|
>
|
||||||
:geoCoordinates="[
|
<GmapMarker
|
||||||
{
|
:key="index"
|
||||||
lat: 51.2432981,
|
v-for="(m, index) in markers"
|
||||||
lng: 6.7950981
|
:position="m.position"
|
||||||
}
|
:clickable="true"
|
||||||
]"
|
:draggable="true"
|
||||||
/>
|
/>
|
||||||
</GoogleMap>
|
</GmapMap>
|
||||||
```
|
</template>
|
||||||
|
```
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@fawmi/vue-google-maps",
|
"name": "@fawmi/vue-google-maps",
|
||||||
"description": "Google Map components for Vue.js 3",
|
"description": "Google Map components for Vue.js 3",
|
||||||
"version": "0.7.0",
|
"version": "0.7.1",
|
||||||
"private": false,
|
"private": false,
|
||||||
"main": "src/main.js",
|
"main": "src/main.js",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
Reference in New Issue
Block a user