Skip to content

Instantly share code, notes, and snippets.

@danilopinotti
Last active November 1, 2021 20:45
Show Gist options
  • Save danilopinotti/aaa56ac73e0d50aebe84b4142145dea0 to your computer and use it in GitHub Desktop.
Save danilopinotti/aaa56ac73e0d50aebe84b4142145dea0 to your computer and use it in GitHub Desktop.
Embedded Google Maps Vue Component to show a given address. Stylized with Tailwind CSS
<template>
<div class="relative text-right" :style="`height: ${height}; width: ${width}`">
<div :style="`height: ${height}; width: ${width}`" class="overflow-hidden bg-none">
<iframe :width="width" :height="height"
:src="mapUrl"
frameborder="0" scrolling="no" marginheight="0" marginwidth="0"></iframe>
</div>
</div>
</template>
<script>
export default {
props: {
address: String,
width: {
default: '250px',
},
height: {
default: '250px',
},
zoom: {
default: 16,
},
},
computed: {
mapUrl() {
return `https://maps.google.com/maps?q=${this.address}&t=&z=${this.zoom}&ie=UTF8&iwloc=&output=embed`
},
},
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment