adding mitt to vue global properties #818
Answered
by
RobertBoes
MellianStudios
asked this question in
Help
-
hello im creating my inertia instance like this require('./bootstrap');
import { createApp, h } from 'vue';
import { createInertiaApp } from '@inertiajs/inertia-vue3';
import { InertiaProgress } from '@inertiajs/progress';
import mitt from 'mitt';
const emitter = mitt();
createInertiaApp({
resolve: name => import(`./Pages/${name}`),
setup({ el, app, props, plugin }) {
createApp({ render: () => h(app, props) })
.mixin({ methods: { route: window.route } })
.use(plugin)
.mount(el)
},
})
InertiaProgress.init(); how can i add mitt to that ? obviously i cant chain .config.globalProperties.emitter = emitter |
Beta Was this translation helpful? Give feedback.
Answered by
RobertBoes
Jul 21, 2021
Replies: 1 comment 1 reply
-
The following should work require('./bootstrap');
import { createApp, h } from 'vue';
import { createInertiaApp } from '@inertiajs/inertia-vue3';
import { InertiaProgress } from '@inertiajs/progress';
import mitt from 'mitt';
const emitter = mitt();
createInertiaApp({
resolve: name => import(`./Pages/${name}`),
setup({ el, app: inertiaApp, props, plugin }) {
const app = createApp({ render: () => h(inertiaApp, props) })
.mixin({ methods: { route: window.route } })
.use(plugin)
app.config.globalProperties.emitter = emitter
app.mount(el)
},
})
InertiaProgress.init(); So, |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
MellianStudios
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following should work
So,
createApp()
returns the Vue instance, save that to a vari…