Skip to content

Commit 4bdd525

Browse files
committed
chore(deps-dev): 🔥 fix some bugs and add nuxt support
1 parent 08a5015 commit 4bdd525

29 files changed

+4351
-20064
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules
22
/demo
33
/src
44
/dist
5+
/nuxt

.eslintrc.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
module.exports = {
22
root: true,
33
env: {
4-
node: true
4+
node: true,
5+
es6: true,
6+
browser: true
57
},
68
'extends': [
79
'plugin:vue/essential',
810
'@vue/standard'
911
],
1012
rules: {
11-
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
13+
'no-console': 'off',
1214
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
1315
},
1416
parserOptions: {

.github/FUNDING.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
patreon: chantouch

.github/dependabot.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
version: 2
2+
updates:
3+
# Fetch and update latest `npm` packages
4+
- package-ecosystem: npm
5+
directory: '/'
6+
schedule:
7+
interval: daily
8+
time: '00:00'
9+
open-pull-requests-limit: 10
10+
reviewers:
11+
- chantouch
12+
assignees:
13+
- chantouch
14+
commit-message:
15+
prefix: fix
16+
prefix-development: chore
17+
include: scope
18+
# Fetch and update latest `github-actions` pkgs
19+
- package-ecosystem: github-actions
20+
directory: '/'
21+
schedule:
22+
interval: daily
23+
time: '00:00'
24+
open-pull-requests-limit: 10
25+
reviewers:
26+
- chantouch
27+
assignees:
28+
- chantouch
29+
commit-message:
30+
prefix: fix
31+
prefix-development: chore
32+
include: scope

.github/workflows/test.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Test
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
push:
8+
branches:
9+
- master
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/[email protected]
16+
- uses: actions/[email protected]
17+
with:
18+
node-version: 14
19+
- run: yarn
20+
- run: yarn test

README.md

+87-78
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![npm](https://img.shields.io/npm/dt/vuejs-google-maps.svg?style=flat-square)](https://npmjs.com/package/vuejs-google-maps)
77

88
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).
1010

1111
## Installation
1212

@@ -17,54 +17,48 @@ yarn add vuejs-google-maps
1717

1818
## Usage
1919

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:
2122

2223
```js
2324
import Vue from 'vue'
2425
import VueGoogleMap from 'vuejs-google-maps'
2526

2627
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-
import Vue from 'vue'
42-
import VueGoogleMap from '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+
}
4932
})
5033
```
5134

52-
- inside nuxt.config.js
35+
## ♻️ Usage with Nuxt.js
5336

54-
place it inside of plugins section
37+
Add `vuejs-google-maps/nuxt` to modules section of `nuxt.config.js`
5538

5639
```js
57-
plugins: [
58-
[...],
59-
{ src: '~/plugins/vuejs-google-maps.js', mode: 'all' }
60-
]
40+
export default {
41+
modules: [
42+
// Simple usage
43+
'vuejs-google-maps/nuxt',
44+
// Passing options in module configuration
45+
['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+
}
6150
```
6251

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.
6455

6556
## Components
6657

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/#/).
6862

6963
* [Marker](#marker)
7064
* [AutoComplete](#autocomplete)
@@ -74,77 +68,88 @@ Here a list of the available components that you can use with this plugin, click
7468
* [Polygon](#polygon)
7569
* [Polyline](#polyline)
7670

77-
7871
#### Marker
7972

8073
The Google Map Marker element require to be inside a `<google-map>` component., it support the __default slot__.
8174

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>
10197
```
10298

10399
#### AutoComplete
104100

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
103+
is triggered with the result.
106104

107-
```html
108-
<google-map-autocomplete
109-
model="String"
110-
types="Array"
111-
controls="Boolean"
112-
update-map="Boolean"
113-
place-changed="Function"
114-
></google-map-autocomplete>
105+
```vue
106+
107+
<template>
108+
<google-map-autocomplete
109+
model="String"
110+
types="Array"
111+
controls="Boolean"
112+
update-map="Boolean"
113+
place-changed="Function"
114+
/>
115+
</template>
115116
```
116117

117118
##### Update V 0.0.6
118-
````html
119-
<template lang="html">
119+
120+
````vue
121+
122+
<template>
120123
<div class="info-windows">
121124
<google-map id="map" ref="Map">
122125
<google-map-marker
123-
:key="index"
124-
v-for="(infowindow, index) in infoWindowsList"
125-
:position="infowindow.position"
126-
@click="toggleInfoWindow(infowindow)"
127-
></google-map-marker>
126+
:key="index"
127+
v-for="(infoWindow, index) in infoWindowsList"
128+
:position="infoWindow.position"
129+
:key="index"
130+
@click="toggleInfoWindow(infoWindow)"
131+
/>
128132
<google-map-infowindow
129-
:position="infoWIndowContext.position"
130-
:show.sync="showInfo"
131-
:options="{maxWidth: 300}"
132-
@info-window-clicked="infoClicked"
133+
:position="infoWIndowContext.position"
134+
:show.sync="showInfo"
135+
:options="{maxWidth: 300}"
136+
@info-window-clicked="infoClicked"
133137
>
134-
<h4>{{infoWIndowContext.title}}</h4>
135-
<p>{{infoWIndowContext.description}}</p>
138+
<h4>{{infoWindowContext.title}}</h4>
139+
<p>{{infoWindowContext.description}}</p>
136140
</google-map-infowindow>
137141
</google-map>
138142
</div>
139143
</template>
140144
141145
<script>
142-
import cities from '../assets/cities.json'
146+
import cities from '~/assets/cities.json'
147+
143148
export default {
144-
data () {
149+
data() {
145150
return {
146151
showInfo: false,
147-
infoWIndowContext: {
152+
infoWindowContext: {
148153
position: {
149154
lat: 44.2899,
150155
lng: 11.8774
@@ -154,7 +159,7 @@ export default {
154159
}
155160
},
156161
methods: {
157-
toggleInfoWindow (context) {
162+
toggleInfoWindow(context) {
158163
this.infoWIndowContext = context
159164
this.showInfo = true
160165
},
@@ -167,6 +172,7 @@ export default {
167172
````
168173

169174
## Added
175+
170176
### @info-window-clicked($event) to info-windows
171177

172178
---
@@ -193,6 +199,9 @@ VUE_APP_GOOGLE_APIKEY=my-apy-key
193199
This package is under the [MIT License](LICENSE).
194200

195201
[npm-image]: https://badge.fury.io/js/vuejs-google-maps.svg
202+
196203
[npm-url]: https://npmjs.org/package/vuejs-google-maps
204+
197205
[daviddm-image]: https://david-dm.org/chantouchsek/vuejs-google-maps.svg?theme=shields.io
206+
198207
[daviddm-url]: https://david-dm.org/chantouchsek/vuejs-google-maps.svg

lib/components/Directions.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@ const redirectedEvents = [
2323

2424
export default {
2525
name: 'GoogleMapDirections',
26-
27-
mixins: [
28-
MapElement
29-
],
30-
26+
mixins: [MapElement],
3127
props: {
3228
origin: {
3329
type: [String, Object],

lib/components/HeatMap.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@ import MapElement from '../mixins/MapElement'
22

33
export default {
44
name: 'GoogleMapHeatmap',
5-
6-
mixins: [
7-
MapElement
8-
],
9-
5+
mixins: [MapElement],
106
props: {
117
data: {
128
type: Array,

lib/components/InfoWindow.js

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export default {
4545
for (let childNode of self.$el.childNodes) {
4646
childNode.addEventListener('click', function (event) {
4747
self.$emit('info-window-clicked', event)
48+
self.$emit('info-window:clicked', event)
4849
})
4950
content.appendChild(childNode)
5051
}

0 commit comments

Comments
 (0)