Update docs
This commit is contained in:
@@ -23,14 +23,16 @@ export default {
|
|||||||
style: {
|
style: {
|
||||||
default: []
|
default: []
|
||||||
},
|
},
|
||||||
|
disableDefaultUI: {
|
||||||
|
type: Boolean,
|
||||||
|
},
|
||||||
options: {
|
options: {
|
||||||
zoomControl: true,
|
zoomControl: true,
|
||||||
mapTypeControl: false,
|
mapTypeControl: true,
|
||||||
scaleControl: false,
|
scaleControl: true,
|
||||||
streetViewControl: false,
|
streetViewControl: true,
|
||||||
rotateControl: false,
|
rotateControl: true,
|
||||||
fullscreenControl: true,
|
fullscreenControl: true,
|
||||||
disableDefaultUI: false
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setup: function(props) {
|
setup: function(props) {
|
||||||
@@ -52,12 +54,25 @@ export default {
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let uiOptions = {}
|
||||||
|
|
||||||
|
if(props.disableDefaultUI) {
|
||||||
|
uiOptions = {
|
||||||
|
disableDefaultUI: true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
uiOptions = props.options
|
||||||
|
}
|
||||||
|
|
||||||
|
const additionalOptions = {...props.options};
|
||||||
|
|
||||||
const mapPromise = mapsLoader.load().then(() => {
|
const mapPromise = mapsLoader.load().then(() => {
|
||||||
const map = new google.maps.Map(mapContainer.value, {
|
const map = new google.maps.Map(mapContainer.value, {
|
||||||
zoom: props.zoom,
|
zoom: props.zoom,
|
||||||
style: props.style,
|
style: props.style,
|
||||||
center: new google.maps.LatLng(38.423733, 27.142826),
|
center: new google.maps.LatLng(38.423733, 27.142826),
|
||||||
mapTypeId: "terrain"
|
mapTypeId: "terrain",
|
||||||
|
...uiOptions
|
||||||
});
|
});
|
||||||
return map;
|
return map;
|
||||||
});
|
});
|
||||||
@@ -70,9 +85,3 @@ export default {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
|
||||||
#map {
|
|
||||||
height: 80vh;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
<template>
|
|
||||||
<p class="demo">
|
|
||||||
{{ msg }}
|
|
||||||
</p>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
msg: 'Hello this is <Foo-Bar>'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
<template>
|
|
||||||
<p class="demo">This is another component</p>
|
|
||||||
</template>
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
<template>
|
|
||||||
<p class="demo">
|
|
||||||
{{ msg }}
|
|
||||||
</p>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
msg: 'Hello this is <demo-component>'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -2,30 +2,40 @@
|
|||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
to install it via NPM
|
This is the base Map component. If no props are provided, it shows an empty map component with default controls.
|
||||||
```bash
|
|
||||||
npm install -S @fawmi/vue-google-maps
|
|
||||||
```
|
|
||||||
You can also install via Yarn
|
|
||||||
```bash
|
|
||||||
yarn add @fawmi/vue-google-maps
|
|
||||||
```
|
|
||||||
|
|
||||||
## Example
|
|
||||||
Here is a basic example
|
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
import { createApp } from 'vue'
|
<GoogleMap />
|
||||||
import googleMap from '@fawmi/vue-google-maps'
|
|
||||||
import App from './App.vue';
|
|
||||||
|
|
||||||
const googleMapOption = {
|
|
||||||
apiKey: 'here_comes_your_api_key',
|
|
||||||
}
|
|
||||||
|
|
||||||
const app = createApp(App);
|
|
||||||
|
|
||||||
app.use(googleMap, googleMapOption)
|
|
||||||
app.mount('#app')
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Provide your own style
|
||||||
|
You can provide custom map styling as prop.
|
||||||
|
|
||||||
|
You can generate custom map styles at [https://mapstyle.withgoogle.com/](https://mapstyle.withgoogle.com/)
|
||||||
|
```javascript
|
||||||
|
<GoogleMap
|
||||||
|
:style="mapStyles"
|
||||||
|
/>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Disable ui elements
|
||||||
|
You can disable all ui components at once
|
||||||
|
```javascript
|
||||||
|
<GoogleMap
|
||||||
|
:disableDefaultUI="true"
|
||||||
|
/>
|
||||||
|
```
|
||||||
|
You can also disable specific UI components
|
||||||
|
|
||||||
|
```vue
|
||||||
|
<GoogleMap
|
||||||
|
:options="{
|
||||||
|
zoomControl: true,
|
||||||
|
mapTypeControl: true,
|
||||||
|
scaleControl: true,
|
||||||
|
streetViewControl: true,
|
||||||
|
rotateControl: true,
|
||||||
|
fullscreenControl: true,
|
||||||
|
}"
|
||||||
|
/>
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user