popup edit show/hide behaviour



  • Hi

    I have a dialog with v-model that is set to false

    <q-dialog v-model="alert">
    

    When I want to show it, I set

    alert=true;
    

    and it shows.

    I want to do the same with popupedit

    <q-popup-edit v-model="showPopup" :cover="false" anchor="center middle">
    

    Clicking a button that sets showPopup to true does make it appear as expected.
    When clicking outside of it, it disappears as expected.
    The problem is when routing in/out from/to the page. When that happens, the popup appears for several seconds and then vanishes. Am I doing something wrong?
    Thanks



  • @amoss try to wrap your routing call in a nextTick.



  • Just one more info that might be relevant: the popup edit is in app.vue so when I wrote route in/out, I actually meant routing between pages inside app.vue.



  • @amoss well something might be changing your popup’s state or the component that holds it is rerendering, if the init state was true then that could be the reason why it’s poping in and out. probably make a minimal codepen that emulates the behavior.



  • I think the problem is the fact it disappears when I click outside of it without actually setting showPopup = false; (hence it remains true).
    I guess my question would be: how to avoid closing the popup when clicking outside of it?
    Thanks

    ps: Did I understand correctly that not only the popup edit itself should v-model=“X” but also all its children components?



  • Just looked into the docs and see popup’s model isnt really for showing or hiding, so when you click outside it cancels the vmodel change and retain its state. There’s persistent prop. A codepen would help.



  • You are right, so I’m even more confused now.
    I tried v-if=“showPopup” but that doesn’t do anything when I set it to true.
    persistent also made it go away when I clicked outside of it.



  • I never used a codepen, I just tried now but it doesn’t seem to know “q-popup-edit” - it just shows the content of it…
    Sorry for a newbie question



  • I read some more and realized that popup edit is not what I need, but a dialog, Thanks!


Log in to reply