Jenesius / vue-modal

🖖The progressive and simple modal system for Vue.js v3
https://modal.jenesius.com
MIT License
145 stars 14 forks source link

problems using namespace with pushModal #111

Closed rmp1985 closed 7 months ago

rmp1985 commented 7 months ago

Please help me. This isn't working: const instanceModal = await pushModal(modalComponent, props, { namespace: "notification" })

But this works: const instanceModal = await pushModal(modalComponent, props)

Where am I going wrong?

I would like to add a namespace so I can later specifically close it with popModal

Jenesius commented 7 months ago

Hi, Did you create namespace's container with name 'notification'?

<!--Default modal container-->
<modal-container/>
<!--Bottom modal container-->
<modal-container namespace="bottom" />
rmp1985 commented 7 months ago

I didn't create it, I even tried it, could you please tell me where I create it? your example put "bottom" and I believe it should be "notification"? There could be a reference for this in the manual (suggestion)

I don't know if this option will help me... I needed to create this dynamically

Jenesius commented 7 months ago

Here I have provided a short example of how this can be done. The main thing is to understand that when we open any modal window, we add it to some namespace. By default it is named 'default' (you don't need to specify it). The default container displays modal windows from the 'default' queue. You need to create another queue (the example shows this in two ways).

rmp1985 commented 7 months ago

Thank you very much. I'm going to study. Actually the problem I'm trying to solve has to do with pushModal with multiple modals. The problem is when it comes to closing the modes. I open two for example. If I run await popModal(); await popModal(); The back one is closing but the front one isn't and this is giving me a big headache. I thought that using a namespace would solve it and it did, but this will create several queues and that is not the purpose of the namespace from what I understand.