diff --git a/README.md b/README.md index 44f44bc..76467bc 100644 --- a/README.md +++ b/README.md @@ -141,6 +141,64 @@ export default { ``` +### Heatmap +If you need to add heatmap layer to the Map, add visualization library in load config and add GMapHeatmap as child of GMapMap component. + +```js +import { createApp } from 'vue' +import VueGoogleMaps from '@fawmi/vue-google-maps' + +const app = createApp(App); +app.use(VueGoogleMaps, { + load: { + key: 'YOUR_API_KEY_COMES_HERE', + libraries: "visualization" + }, +}).mount('#app') + +``` + +```vue + + +``` + Checkout docs for more component ## Access map object diff --git a/src/components/heatmap.js b/src/components/heatmap.js new file mode 100644 index 0000000..3a2776c --- /dev/null +++ b/src/components/heatmap.js @@ -0,0 +1,25 @@ +import buildComponent from './build-component.js' + +const props = { + options: { + type: Object, + twoWay: false, + default: () => { + }, + }, + data: { + type: Array, + twoWay: true + }, +} + +const events = []; + +export default buildComponent({ + mappedProps: props, + name: 'heatmap', + ctr: () => google.maps.visualization.HeatmapLayer, + events, +}) + + diff --git a/src/main.js b/src/main.js index 9bc71d0..8b639a7 100644 --- a/src/main.js +++ b/src/main.js @@ -9,6 +9,7 @@ import Marker from './components/marker.vue' import GMapCluster from './components/cluster.vue' import InfoWindow from './components/infoWindow.vue' import Map from './components/map.vue' +import Heatmap from './components/heatmap' import Autocomplete from './components/autocomplete.vue' import MapElementMixin from './components/mapElementMixin' @@ -28,6 +29,7 @@ export { InfoWindow, Map, MapElementMixin, + Heatmap, buildComponent, Autocomplete, MountableMixin, @@ -72,6 +74,7 @@ export default function install(Vue, options) { Vue.component('GMapCircle', Circle) Vue.component('GMapRectangle', Rectangle) Vue.component('GMapAutocomplete', Autocomplete) + Vue.component('GMapHeatmap', Heatmap) } }