Change ok button of dialog depending on tab selected

  • Hello,
    I’d like to change the button of a dialog when a tab in this dialog is selected.
    I already have <q-tab @select=“changeInstitution()” … but I have the impression that the “ok” button of the dialog can’t be linked to any model…
    How can I do that?
    Thanks in advance!

  • Bind your label prop button to a computed properties.

    In this computed properties return a value depending on your selected tab.

  • That is exactly what I want to do, but How can I do it? I tried to put
    But it only displays “myButton”. What is the correct syntax?

  • you can have a prop in your modal for your custom label.
    And change this prop value on <q-tabs> select event

    See an example:

  • Thanks, I understand better quasar mechanics thanks to you.
    Dialog doesn’t allow a dynamic button for “OK”, but with “Modal” I can emulate a dialog with this functionality, right?

  • You can refer to the documentation concerning Dialog: This means Dialogs should only be used for quick actions, like password verification, small App notifications or quick options. More in depth user flows should be reserved for ​Modals​.

    So you are right. If your “floating” component is a little complex, it’s better to use Modal

  • Thanks a lot for your answer.
    It was unclear why a component was a sub-component of another, now I understand the principle, although I don’t agree with it 🙂

Log in to reply