@rab
A Problem
Vue 3 instances no longer implement the event emitter interface.
Recommendation is to use mitt.
See:
https://github.com/vuejs/rfcs/blob/master/active-rfcs/0020-events-api-change.md
A Solution
Load the code below as a boot file (e.g. pagebus.js).
Using this.$on is detected as error so am using $$on instead.
// file boot/pagebus.js
import { boot } from 'quasar/wrappers'
import mitt from 'mitt'
export default boot(({ app }) => {
app.use({
install: function (Vue, options) {
const pagebus = mitt()
app.config.globalProperties.$$on = pagebus.on
app.config.globalProperties.$$emit = pagebus.emit
}
})
})
If you wish to debug:
...
app.config.globalProperties.$$on = function (ev, ...args) {
console.log(ev, args)
return pagebus.on(ev, ...args)
}
...