12

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.

3 Answers 3

17

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

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

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 },
};
1
  • 1
    apparently the same applies to Vite
    – syldman
    May 13, 2022 at 12:42
0

Quasar vite plugin + vue3

In main.ts or main.js, just add these 2 lines :

JS
import { Notify } from "quasar";
.use(Quasar, {
    plugins: {
        Notify,
    }, // import Quasar plugins and add here
})

Here a example of my code :

JS
import { createApp } from 'vue'

import { Quasar } from 'quasar'
import quasarLang from 'quasar/lang/fr'
import { Notify } from "quasar";
import router from './router'
import { createPinia } from 'pinia'
import './style.css'


// Import icon libraries
import '@quasar/extras/material-icons/material-icons.css'

// Import Quasar css
import 'quasar/src/css/index.sass'

import App from './App.vue'

const pinia = createPinia()

createApp(App)
.use(Quasar, {
    plugins: {
        Notify,
    }, // import Quasar plugins and add here
    lang: quasarLang,
})
.use(router)
.use(pinia)
.mount('#app')
1
  • Add language in code block so that it can provide better highlights. Like for Javascript js Code Jan 26 at 2:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.