inocan-group / vue3-google-map

A set of composable components for easy use of Google Maps in your Vue 3 projects.
https://vue3-google-map.com
MIT License
299 stars 60 forks source link

Hope that only one InfoWindow will be displayed at a time when multiple markers are bound to InfoWindow #294

Closed deidei1231 closed 4 days ago

deidei1231 commented 4 days ago
<AdvancedMarker v-for="item in useStore.getUserGpsData" :key="item.id"
                    :options="{position: handleGpsLocation(item), content: createMarkerHtml(item)}"
                    @click="handleMarkClick(item,$event)">
      <InfoWindow
          :options="{ content: infoWindowContent(item), headerContent: 'User Information'}"
      />
    </AdvancedMarker>
<!--        <InfoWindow `ref="infoWindowEl"/>-->

Every time I click on a marker, an InfoWindow is added. If I define a InforWindow in a subcomponent of GoogleMap and obtain it through the ref of vue3, the Elements obtained at this time are only open() and close(), but there is no native setPosition() method. I cannot implement the only InforWindow component.

2

So i hope that only one InfoWindow will be displayed at a time when multiple markers are bound to InfoWindow. Keep only the last one