Error Dialog is defined but never used
-
Heloo Im a beginner trying to use q-dialog but am I getting that error ?
Did I miss anything ? -
i still stuck . anyone?
-
You need to show your code so other can help.
-

-
i commented the import Dialog because it keep causing me error?
-
I don’t think it’s appropriate to be putting it in your
data ()
function. Create a function in yourmethods:
and call it from there.onSetHomePosition: function () { this.$q.dialog({ color: 'teal-6', title: 'Warning', message: `Permanently replace the Home Position for '${this.cameraItem.data.name}'?`, ok: 'YES', cancel: 'NO' }) .then(() => { // user selected ok this.$emit('setHomePosition', this.cameraItem) }) .catch(() => { // user selected cancel }) }
-
Did you import the Dialog component after script tag ?
-
in
quasar.conf.js
add'Dialog'
to theplugins:
array:// Quasar plugins plugins: [ 'Dialog', 'Notify', 'AppFullscreen' ]
-
Do i need to include import dialog as shown in the first picture ? cause its the one causing this error
what did i do wrong ?
-
@ninafar You don’t have to import Dialog in your components, you can just use
this.$q.dialog
and if you want to use Dialog in the externas js files than you have to import it.
As the documentation said// outside of a Vue file import { Dialog } from 'quasar' (Promise) Dialog.create(configObj) // inside of a Vue file (Promise) this.$q.dialog(configObj)
-
Just remove the import of
Dialog
as you have made it available as a Quasar plugin, meaning it is not accessible viathis.$q.dialog
. -
Its working fine now . Thank you, gentlemen!