Closed hdrodel closed 3 months ago
I got something working but i don't know if that really is how it was supposed to be done
<template>
<GoogleMap
api-key="<key>"
:api="google"
ref="mapRef"
>
<!--adding markers here-->
</GoogleMap>
</template>
<script>
import { Loader } from "@googlemaps/js-api-loader";
export default {
data() {
return {
google: null,
loader: new Loader({apiKey: <key>, version: "weekly"})
};
},
async mounted() {
this.google = await this.loader.importLibrary("maps");
this.trafficLayer = new this.google.TrafficLayer();
await nextTick();
console.log(this.trafficLayer);
this.trafficLayer.setMap(this.$refs.mapRef.map);
},
};
</script>
Any better way to do this?
What would be the best practice to display a traffic layer on the map?