You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This package is under active development, the documentation is not complete yet, so if is missing something open a
9
-
request or look at the [source code](https://github.com/chantouchsek/vuejs-google-map).
9
+
request or look at the [source code](https://github.com/chantouchsek/vuejs-google-map).
10
10
11
11
## Installation
12
12
@@ -17,54 +17,48 @@ yarn add vuejs-google-maps
17
17
18
18
## Usage
19
19
20
-
Before starting you need a Google API key from the [developer console](http://console.developers.google.com/), once you obtained your key, import the module in your application and register it as plugin:
20
+
Before starting you need a Google API key from the [developer console](http://console.developers.google.com/), once you
21
+
obtained your key, import the module in your application and register it as plugin:
21
22
22
23
```js
23
24
importVuefrom'vue'
24
25
importVueGoogleMapfrom'vuejs-google-maps'
25
26
26
27
Vue.use(VueGoogleMap, {
27
-
load: {
28
-
apiKey:'your-api-key',
29
-
libraries: ['...']
30
-
}
31
-
})
32
-
```
33
-
34
-
# Nuxt support
35
-
36
-
- create a file inside plugins folder
37
-
``vuejs-google-maps.js``
38
-
39
-
40
-
```js
41
-
importVuefrom'vue'
42
-
importVueGoogleMapfrom'vuejs-google-maps'
43
-
44
-
Vue.use(VueGoogleMap, {
45
-
load: {
46
-
apiKey:'your-api-key',
47
-
libraries: ['...']
48
-
}
28
+
load: {
29
+
apiKey:'your-api-key',
30
+
libraries: [/* rest of libraries */]
31
+
}
49
32
})
50
33
```
51
34
52
-
- inside nuxt.config.js
35
+
## ♻️ Usage with Nuxt.js
53
36
54
-
place it inside of plugins section
37
+
Add `vuejs-google-maps/nuxt` to modules section of `nuxt.config.js`
['vuejs-google-maps/nuxt', {api:'xxxxxx', libraries: [/* rest of libraries */]}]
46
+
],
47
+
// Passing options in module top level configuration
48
+
googleMaps: {api:'xxxxxx', libraries: [/* rest of libraries */]}
49
+
}
61
50
```
62
51
63
-
This module tries to map GoogleMap with Vue components as much as possible so any of the options available on the original GoogleMap class will be available as component props and all the events emitted will be mapped to component events.
52
+
This module tries to map GoogleMap with Vue components as much as possible so any of the options available on the
53
+
original GoogleMap class will be available as component props and all the events emitted will be mapped to component
54
+
events.
64
55
65
56
## Components
66
57
67
-
Here a list of the available components that you can use with this plugin, click on them to discover more about the usage and see examples. If you are interested to see a __real life use__ checkout the [example](https://github.com/chantouchsek/vuejs-google-maps/tree/master/demo) folder which contains the source code of the [website](http://vuejs-google-maps.bookingkh.com/#/).
58
+
Here a list of the available components that you can use with this plugin, click on them to discover more about the
59
+
usage and see examples. If you are interested to see a __real life use__ checkout
60
+
the [example](https://github.com/chantouchsek/vuejs-google-maps/tree/master/demo) folder which contains the source code
61
+
of the [website](http://vuejs-google-maps.bookingkh.com/#/).
68
62
69
63
*[Marker](#marker)
70
64
*[AutoComplete](#autocomplete)
@@ -74,77 +68,88 @@ Here a list of the available components that you can use with this plugin, click
74
68
*[Polygon](#polygon)
75
69
*[Polyline](#polyline)
76
70
77
-
78
71
#### Marker
79
72
80
73
The Google Map Marker element require to be inside a `<google-map>` component., it support the __default slot__.
81
74
82
-
```html
83
-
<google-map-marker
84
-
title="String"
85
-
label="String|Object"
86
-
clickable="Boolean"
87
-
draggable="Boolean"
88
-
visible="Boolean"
89
-
z-index="Number"
90
-
click="Function"
91
-
dblclick="Function"
92
-
rightclick="Function"
93
-
drag="Function"
94
-
dragstart="Function"
95
-
dragend="Function"
96
-
mouseup="Function"
97
-
mousedown="Function"
98
-
mouseover="Function"
99
-
mouseout="Function"
100
-
></google-map-marker>
75
+
```vue
76
+
77
+
<template>
78
+
<google-map-marker
79
+
title="String"
80
+
label="String|Object"
81
+
clickable="Boolean"
82
+
draggable="Boolean"
83
+
visible="Boolean"
84
+
z-index="Number"
85
+
click="Function"
86
+
dblclick="Function"
87
+
rightclick="Function"
88
+
drag="Function"
89
+
dragstart="Function"
90
+
dragend="Function"
91
+
mouseup="Function"
92
+
mousedown="Function"
93
+
mouseover="Function"
94
+
mouseout="Function"
95
+
/>
96
+
</template>
101
97
```
102
98
103
99
#### AutoComplete
104
100
105
-
The AutoComplete component does not require to be inside a `<google-map>` component, it can be used anyway inside your app. It display an input and optionally the autocomplete controls, when a place is selected the __place-changed__ event is triggered with the result.
101
+
The AutoComplete component does not require to be inside a `<google-map>` component, it can be used anyway inside your
102
+
app. It display an input and optionally the autocomplete controls, when a place is selected the __place-changed__ event
0 commit comments