Home > Software design >  Quasar programatically closes popup dialog after all processing completes
Quasar programatically closes popup dialog after all processing completes

Time:01-28

I have a q-dialog component that has 2 buttons - CANCEL and OK. Cancel button uses v-close-popup but OK can't use that as it is doing some async data fetching, fill some UI element on the dialog and do some processing before it closes automatically. I tried to use v-close-popup and it results in undefined UI element when document.getElementById is called on the existing UI element because the dialog has closed before the processing completes. I need the UI element in the processing part because I use easyqrcodejs which needs a UI element to generate QR code. Any idea and insight is appreciated. Thanks.

CodePudding user response:

Without your code is difficult to know exactly what you need.

TEMPLATE

<q-dialog v-model="isDialogOpen" />

SCRIPT

setup() {
 async function fetchData() {
   // do some await things here

   // done with await update v-model (if using Composition API)
   isDialogOpen.value = false;
 }
 

  // ...
  return { isDialogOpen }
}

If you update your question with some code, I will update mine.

  •  Tags:  
  • Related