diff --git a/README.md b/README.md index 4f3e2ad..a0536c1 100644 --- a/README.md +++ b/README.md @@ -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/). @@ -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, }, }) ``` diff --git a/src/components/Map.vue b/src/components/Map.vue index 9552304..818d8f5 100644 --- a/src/components/Map.vue +++ b/src/components/Map.vue @@ -105,6 +105,7 @@ export default { type: Number, }, zoom: { + required: true, type: Number, }, }, diff --git a/src/lib-loader.js b/src/lib-loader.js index 6667a92..d860aa8 100644 --- a/src/lib-loader.js +++ b/src/lib-loader.js @@ -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() @@ -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)