jerosoler / Drawflow

Simple flow library 🖥️🖱️
https://jerosoler.github.io/Drawflow/
MIT License
4.42k stars 714 forks source link

How can I use a different drawflow parent other than app in vue3 #733

Open longtengz opened 12 months ago

longtengz commented 12 months ago

Hi, I'm trying to upgrade our app from vue2 to vue3. In vue2, we can set drawflow's parent to whatever component we feed it through the last parameter of the constructor. But in vue3, it seems from we can only give appContext as parent.

This troubles us because we're trying to use provide and inject so drawflow nodes can have reactive data changed elsewhere in the app. Now since the parent can only be app, provide and inject no longer works in our setting.

Is there a way we can set a different parent in vue3 other than appContext

Thanks for for this amazing library. I hope to contribute to it but I don't know much about vue's internals to make a PR here.

jerosoler commented 12 months ago

You can see in the vue3 example. How do we pass the property df.

To access from the nodes.

I don't know if this will help you.

longtengz commented 12 months ago

Besides using globalProperties, do you see another way to make it work? We have a bunch of provides and injects so it's not very ideal to use globalProperties and also it's not recommended in Vue.

Thanks for your prompt reply.

jerosoler commented 12 months ago

🤔 Creating standalone apps? With "createApp"?