[Solved] Unhandled promise rejection TypeError: "_this.$q.dialog is not a function"



  • I don’t know why I am getting this error (and no dialog showing), any suggestions?

    1. I have verified that I added the component 'Dialog" to the list in quasar.conf.js
    2. I am using this code to call it:
    this.$q.dialog({
                    title: 'Confirm',
                    message: 'There is a new version available. Your version will be updated.',
                    ok: 'Update'
                  }).then(() => {
                    window.location.reload(true)
                    this.$setItem('myapp_version', this.curVersion)
                  }).catch(() => {
                    alert('Houston...')
                  })
    

    Is there something wrong or missing? Why would I get that error? I am using latest Quasar ( CLI v0.17.15 and Framework v0.17.12)



  • UGH nevermind…I had accidentally added ‘Dialog’ to COMPONENTS list instead of PLUGINS list!



  • Yeah I happened the same to me. They should specify at the very begining that there are 2 ways of using it: as plugin, and as a component.



  • @ssuess
    I know it’s an old topic but it helped me to solve a problem that I didn’t fix, thank you very much



  • They are separate in the docs though, Dialog and QDialog respectively. Q prefixed means it’s a component.



  • I had the same problem and expected the quasar cli to add the plugin dependency automatically but it only does so for components. So as the docs clearly mention one should add the plugin manually:

    // quasar.conf.js
    
    return {
      framework: {
        plugins: [
          'Dialog'
        ]
      }
    }
    

Log in to reply