Skip to content

Commit

Permalink
chore: merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed May 20, 2018
2 parents 99d2940 + bef4587 commit 8cefcc4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ npm i -S vue-googlemaps
yarn add vue-googlemaps
```

*You need to [polyfill](https://babeljs.io/docs/usage/polyfill/) some ES2015 features in old browsers.*

## Usage

You need a Google API key from the [devlopper console](http://console.developers.google.com/).
Expand All @@ -44,6 +46,8 @@ Vue.use(VueGoogleMaps, {
apiKey: 'your-google-api-key',
// Enable more Google Maps libraries here
libraries: ['places'],
// Use new renderer
useBetaRenderer: false,
},
})
```
Expand Down
1 change: 1 addition & 0 deletions src/components/Map.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export default {
type: Number,
},
zoom: {
required: true,
type: Number,
},
},
Expand Down
9 changes: 6 additions & 3 deletions src/lib-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const loader = {
* @param loadCn Boolean. If set to true, the map will be loaded form goole maps China
* (@see https://developers.google.com/maps/documentation/javascript/basics#GoogleMapsChina)
*/
load ({ apiKey, version, libraries, loadCn }) {
load ({ apiKey, version, libraries, loadCn, useBetaRenderer }) {
if (typeof window === 'undefined') {
// Do nothing if run from server-side
return Promise.resolve()
Expand Down Expand Up @@ -58,8 +58,11 @@ const loader = {
.map((key) => encodeURIComponent(key) + '=' + encodeURIComponent(options[key]))
.join('&')

if (version) {
url = url + '&v=' + version
const usingBetaRenderer = (version && version === '3.exp') ||
(typeof useBetaRenderer === 'boolean' && useBetaRenderer === true)

if (usingBetaRenderer || version) {
url = url + '&v=' + (usingBetaRenderer ? '3.exp&slippy=true' : version)
}

googleMapScript.setAttribute('src', url)
Expand Down

0 comments on commit 8cefcc4

Please sign in to comment.