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

Vue warnings when using polygon event listeners

Open aden1974 opened this issue 2 years ago • 7 comments

When GMapPolygon has click or right click event handlers it works, but in the browser console I see a lot of Vue warnings like the following: [Vue warn]: Extraneous non-emits event listeners (click, rightclick) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option. at <GMapPolygon key="32b8f558-cbee-4680-bf93-b936fd68b6b4" paths= (45) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}] options= {clickable: true, fillColor: '#7b95a2', fillOpacity: 0.25, strokeColor: '#7b95a2', strokeOpacity: 0.8, …} ... > at <Map key=0 ref="mapRef" class="map" ... > at <MapView zoom=4 center= {lat: 42.23854775620807, lng: 4.656360580576284} map-type-id="roadmap" ... > at <Map onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< Proxy {__v_skip: true} > key=undefined > at <RouterView> at <QPageContainer> at <QLayout view="hHh lpR fFf" > at <AppLayout> at <App>

aden1974 avatar Apr 30 '22 09:04 aden1974

Yeah we have the same issue. We use the "dragend" Event and the vue warning is showing every time.

Jonas096 avatar May 04 '22 09:05 Jonas096

Same issue, hope there's some solution.

andyjjrt avatar Jul 06 '22 07:07 andyjjrt

Having the same problem can get some events like "mouseup" to trigger and return an event, but it still throws the error:

[Vue warn]: Extraneous non-emits event listeners (mouseup) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.

But paths_changed doesn't emit anything and just throws the error

jreidko avatar Jul 27 '22 18:07 jreidko

I have the same issue with @click event.

Timme777 avatar Nov 14 '22 15:11 Timme777

Same issue here with latest version 0.9.79

rick20 avatar May 05 '23 07:05 rick20

Finally got a workaround to fix this issue. In my case, I just need to remove the vite pre-bundling cache:

rm -rf node_modules/.vite

and then re-run the vite and it is back to work again.

rick20 avatar May 05 '23 13:05 rick20

The warnings make me crazy! Finally i find the way to resolve this issue. First, you need to modify "./node_modules/@fawmi/vue-google-maps/src/components/build_component.js" file and then remove the vite pre-bundling cache.

// modify "build-component.js" 
return {
    ...(typeof GENERATE_DOC !== 'undefined' ? { $vgmOptions: options } : {}),
    mixins: [MapElementMixin],
    inheritAttrs: false,  // add this property
    props: {
      ...props,
      ...mappedPropsToVueProps(mappedProps),
    },
    // ....
}
# remove cache
rm -rf  node_modules/.cache/vite 

my version is 0.9.79

yolain avatar Jul 27 '23 05:07 yolain