Alert - callback on dismissable x clicked



  • Hi,

    i need to know the visibility state of my Alert which i have created programmatically.

    i want to show an Alert as a response of form validation, but i never want to show more than one Alert at the same time. so i need to know if the user manually has close the alert.

    can anyone help me?



  • Check at the bottom of the docs.

    Alert also supports the v-model directive to receive a Boolean as a property. This determines the visibility of the QAlert (true means it’s visible).

    That should be what you need I think.

    Scott



  • Hey @s-molinari ,

    yes, i saw this part in documentation. but i use the Alerts by programmatically way.



  • I would also appreciate this.



  • You both need to check your basics…

          <q-alert
            color="positive"
            icon="cloud"
            enter="bounceInLeft"
            leave="bounceOutRight"
            position="top-right"
            :actions="[{label: 'Snooze', handler () {}}]"
            v-model="showAlert"
          >
            Some cool message for your users.
          </q-alert>
    
      data() {
        return {
          showAlert: false
        }
      },
      methods: {
        show() {
          this.showAlert = true
        },
        hide() {
          this.showAlert = false
        }
      }
    

Log in to reply
 

Looks like your connection to Quasar Framework was lost, please wait while we try to reconnect.