vue-google-maps icon indicating copy to clipboard operation
vue-google-maps copied to clipboard

Defining map `center` in `options` instead of in a prop fails since it is a required prop

Open aentwist opened this issue 2 years ago • 0 comments

center should be able to be defined in options instead of having to be a separate prop (see MapOptions.center).

Steps to reproduce

  1. Define a map with center inside of options instead of in the center 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

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" />

aentwist avatar Feb 03 '22 18:02 aentwist