Skip to content
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

How to set plugins on a <b-modal> #32

Closed
mateuswetah opened this issue Aug 14, 2023 · 10 comments
Closed

How to set plugins on a <b-modal> #32

mateuswetah opened this issue Aug 14, 2023 · 10 comments
Assignees
Labels
question Further information is requested

Comments

@mateuswetah
Copy link

mateuswetah commented Aug 14, 2023

Hey guys, its me again 🥲

Not a bug this time, but a question.

It took me a while to understand but I see now how the current BModal is it's own Vue instance, thus any component or plugin registered to my original Vue with Buefy instance won't work on it. If I use the programmatic instantiation of the modal that is simple, I can obtain the returned object and register on it. But what if I'm just using the component <b-modal> directly in my template?

@wesdevpro wesdevpro added the question Further information is requested label Aug 14, 2023
@kikuomax
Copy link
Collaborator

kikuomax commented Aug 15, 2023

@mateuswetah As long as you embed <b-modal> in your template, plugins used by the app that is mounting the template are available for that <b-modal>. Only programmatically opened BModal has its own Vue app.

@kikuomax
Copy link
Collaborator

@mateuswetah Unfortunately, I do not think you can add plugins to a programmatically opened instance of BModal, because plugins are not installed into a Vue component instance but a Vue app. We may need an additional option to the open function to inject plugins.

@mateuswetah
Copy link
Author

@mateuswetah As long as you embed <b-modal> in your template, plugins used by the app that is mounting the template are available for that <b-modal>. Only programmatically opened BModal has its own Vue app.

Ohh ok, I did not understood that at first!

@mateuswetah
Copy link
Author

@mateuswetah Unfortunately, I do not think you can add plugins to a programmatically opened instance of BModal, because plugins are not installed into a Vue component instance but a Vue app. We may need an additional option to the open function to inject plugins.

Damn that is a serious issue then. I use it a lot for different cases like translation, store, capabilities... If we can think of a way to pass this as parameters would be very important

@mateuswetah
Copy link
Author

Just reminded that Oruga also offers a programmatic launch of Modal:
https://oruga.io/components/Modal.html

Maybe take a look at their strategy?

@kikuomax
Copy link
Collaborator

@kikuomax
Copy link
Collaborator

@wesdevpro @mateuswetah I am addressing the issue in #101.

I came up with a simple solution thanks to your information, @mateuswetah!

@mateuswetah
Copy link
Author

Hi @kikuomax! Thank you for all the work being done here. I've been using the programmatic launch of modals and they are working well so far. One thing that is happening is a warning that appears only for programmatic launch, in all of my usages where I pass a custom component. For example:
image

The modal initialization would be something like this:
image
I'm sorry for posting questions here, but would you have any idea of which v-on it might be referring to?

@kikuomax
Copy link
Collaborator

kikuomax commented Jan 24, 2024

@mateuswetah I confirmed that also happened in my project. I opened a new issue:

@erasse
Copy link

erasse commented Jan 26, 2024

@mateuswetah , @kikuomax from my observations, as a workaround an empty events object can be passed to modal, this should remove the warning

this.$buefy.modal.open({
     parent: this,
     component: CapabilityEditionModal,
     props: {
          capability: this.capabilities[capabilityKey],
         capabilityKey: capabilityKey,
    },
   trapFocus: true,
   customClass: tainacan-modal
   closeButtonArialLabel: this.$i18n.get('close'),
   events: {},
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
Status: ✅ Done
Development

No branches or pull requests

4 participants