Skip to content

Use Vue 3 render function with using @vue/compat #147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

baptistejamin
Copy link

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

Copy link

@amokrunner amokrunner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified this works now with the @vue/compat build.

@mikeu
Copy link
Contributor

mikeu commented Feb 5, 2023

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?

@ghost
Copy link

ghost commented Apr 20, 2023

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.

@viracoding
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants