Notifications failing at notify()

Viewed 2760

I am trying to fire a simple notification in Quasar 2:

setup() {
  const $q = useQuasar()
   $q.notify('hello')
}

This fails with:

Uncaught TypeError: $q.notify is not a function

This is a UMD application that works fine without these two lines - I do not really know where to go from there as the docs say that there is nothing special to configure before using it.

Incindentally, my IDE is suggesting me notify() when typing $q. so at least at that level is it well recognized.

2 Answers

I think you forgot to add notify in plugins(quasar.conf.js).

return {
  framework: {
    plugins: [
      'Notify'
    ],
  }
}

For those using Vue CLI, you will need to work on quasar-user-options.js:

import { Notify } from "quasar";

// To be used on app.use(Quasar, { ... })
export default {
   plugins: { Notify },
};
Related