My latest project involves working with the Quasar framework in combination with vuejs 2
One of the key files in my project is located at /src/boot/gfunc.js
import Vue from 'vue'
Vue.prototype.$module = 'foo';
Within /quasar.conf.js
boot: ['gfunc'],
And in /src/pages/Foo.vue
beforeCreate : function () {
console.log(this.$module);
}
Everything is functioning as expected, and I can see foo in the console
Recently, I decided to upgrade to vuejs 3 while still using the Quasar framework. I discovered that Vue.prototype has been replaced by app.config.globalProperties [Doc]
Here are the changes I made:
Updating /src/boot/gfunc.js according to the [documentation]
import { createApp } from 'vue'
import Vue from 'vue'
const app = createApp({})
app.config.globalProperties.$module = 'foo';
And in /quasar.conf.js
boot: ['gfunc'],
Also, in /src/pages/Foo.vue
beforeCreate : function () {
console.log(this.$module);
}
However, this time it's not working as expected. The console is showing undefined