Dec 21, 2021
0
Level 1
Inertia.js add vue plugin
Hi, im new to Laravel/ inertia.js and cant figure out how to add a vue plugin (ht tps://vuejsexamples.com/single-flash-message-with-vue/). My app.js looks like this:
require('./bootstrap');
import {createApp, h} from 'vue';
import {createInertiaApp} from '@inertiajs/inertia-vue3';
import {InertiaProgress} from '@inertiajs/progress';
import FlashMessage from '@smartweb/vue-flash-message';
const appName = window.document.getElementsByTagName('title')[0]?.innerText || 'Laravel';
const vueApp = createInertiaApp({
title: (title) => `${title} - ${appName}`,
resolve: (name) => require(`./Pages/${name}.vue`),
setup({el, app, props, plugin}) {
return createApp({render: () => h(app, props)})
.use(plugin).use(FlashMessage)
.mixin({methods: {route}})
.mount(el);
},
});
//vueApp.use(FlashMessage);
InertiaProgress.init({color: '#4B5563'});
Referencing it through
<FlashMessage></FlashMessage>
gives the following error:
TypeError: t is not a constructor
Any help is really appreciated.
Please or to participate in this conversation.