vue-google-maps
vue-google-maps copied to clipboard
Defining map `center` in `options` instead of in a prop fails since it is a required prop
center
should be able to be defined in options
instead of having to be a separate prop (see MapOptions.center).
Steps to reproduce
- Define a map with
center
inside ofoptions
instead of in thecenter
prop
<template>
<GMapMap style="height: 900px" :options="mapOptions" />
</template>
<script lang="ts">
import { defineComponent } from "vue";
export default defineComponent({
setup() {
const mapOptions = {
center: { lat: 0, lng: 0 },
};
return {
mapOptions,
};
},
});
</script>
Expected behavior
No errors
Actual behavior
- Warning: missing required prop
center
-
Error:
this.center
is undefined
Environment
$ cat /etc/os-release | head -n 1
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
uname -r
5.10.16.3-microsoft-standard-WSL2
Firefox 96.0.3 (64-bit)
Additional notes
mapOptions
is not made reactive here.
Workaround
<GMapMap style="height: 900px" :center="mapOptions.center" :options="mapOptions" />