No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Is it possible to load/render components in Qdialog?

    Framework
    2
    3
    527
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      ebena last edited by ebena

      Is there any way to load or render components into Qdialog? Please I need to know if it is possible and if any example/sample of such methods is available

      A scenario.

      <q-toolbar>
         <q-select v-model="event" :option="eventtype" @input="onEventChange()" label="Select Event" />
      </q-toolbar>
      
      <q-dialog>
      
      </q-dialog>
      

      And in the script,

      <script>
      import eventList from 'statics/data/event.json'
      
      export default {
          data () {
               return {
                   event: null,
                   dialog: false,
                   app: {
                      title: ' '
                      url: ' '
               }
         },
       computed: {
           eventtype () {
               return eventList
          }
      },
      methods: {
        onEventChange () {
          if (this.event === "New Entry" {
             this.app.title = 'New Entry Form'
             this.app.url = 'components/forms/newEntryForm.Vue'
      } else  if (this.event === "Edit Entry" {
            this.app.title = 'Edit User details'
            this.app.url = 'components/forms/editForm.Vue'
      }
      
      }
      </script>
      

      Question
      How can I use Qdialog to load either newEntryForm.vue or editForm.vue depending on event selected by the user?

      1 Reply Last reply Reply Quote 0
      • J
        jraez last edited by jraez

        You can use your own/custom component as dialog

        https://quasar.dev/quasar-plugins/dialog#Invoking-custom-component

        Within this custom components, you can import or use whatever other custom components (or Form) you need.

         onEventChange () {
            if (this.event === "New Entry" {
               this.app.title = 'New Entry Form'
               this.app.url = 'components/forms/newEntryForm.Vue'
                this.$q.dialog({
                  component: NewEntryForm,
                  parent: this,
                  app: this.app
                })
        } else  if (this.event === "Edit Entry" {
              this.app.title = 'Edit User details'
              this.app.url = 'components/forms/editForm.Vue'
              this.$q.dialog({
               component: editForm,
               parent: this,
              app: this.app
             })
        }
        
        E 1 Reply Last reply Reply Quote 1
        • E
          ebena @jraez last edited by

          @jraez Thank you so much.
          It work.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post