khteh
khteh

Reputation: 3892

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>?

Upvotes: 2

Views: 2467

Answers (1)

khteh
khteh

Reputation: 3892

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

Upvotes: 1

Related Questions