Search code examples
vuejs2global-variablesquasar-frameworkquasar

Quasar 2 Vue 3 how to access app.config.globalProperties through "this" object in .vue files?


I am using Quasar 2 Vue 3. Currently I need to import app from "../boot/firebaseConfig"; in every .vue files and access global variables using app.config.globalProperties.<foo> syntax. Is there anyway to shorten this to just using this.<foo>?


Solution

  •   data() {
        return {
          db: app.config.globalProperties.$db
        }
      },
      methods: {
        method1() { this.db ...}
      }