vue-leaflet icon indicating copy to clipboard operation
vue-leaflet copied to clipboard

Use Vue 3 render function with using @vue/compat

Open baptistejamin opened this issue 2 years ago • 3 comments

When an app uses @vue/compat (Vue 3.1), it renders components using compat mode, including libraries like vue-leaflet.

It breaks some properties like $slots.default().

To prevent this from happening, we are forcing LMap and LIcon components to run with Vue 3 rendering functions

baptistejamin avatar Jul 26 '21 08:07 baptistejamin

Hi @baptistejamin , I know this is a very old issue at this point, and I'm sorry for that, but I've just merged #218 which resolved #138. If this is still of interest to you, could you please let me know whether v0.8.2 resolves this problem as well, as the comments on the other issue indicate it might?

mikeu avatar Feb 05 '23 23:02 mikeu

I recently struggled with this exact same issue. Unfortunately, newer versions such as v0.8.2 or v0.9.0 didn't solve the issue for me. The changes proposed in this pull request do seem to work though.

For anyone struggling with this; as an easy workaround, I temporarily made changes to the distributed file ./dist/vue-leaflet.es.js, replacing the first line with the following four lines (inspired by Josh's post on StackOverflow):

import { watch as de, ref as c, provide as G, inject as h, h as z, onUnmounted as se, onBeforeUnmount as J, defineComponent as defaultDefineComponent, onMounted as O, markRaw as C, nextTick as f, render as Je, reactive as Ke, computed as x } from "vue";
const g = (obj) => defaultDefineComponent({...obj, compatConfig: {
  RENDER_FUNCTION: false,
}})

Be advised though as this is not a reliable solution! Hopefully the changes proposed in this PR will one day be merged into master, giving those who need to use @vue/compat a working version of vue-leaflet.

giloliveira-nmi avatar Apr 20 '23 16:04 giloliveira-nmi

in the version 0.9.0 this issue still exists. Is this PR going to be merged?

viracoding avatar Jun 19 '23 20:06 viracoding