Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

muazzamazaz's avatar

Vue Component is not being rendered in blade file

app.js

import './bootstrap';
import '../css/app.css';

import { createApp, h } from 'vue';
import { createInertiaApp } from '@inertiajs/vue3';
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';
import { ZiggyVue } from '../../vendor/tightenco/ziggy';
import Menu from '@/Components/AppMenu.vue';
const appName = import.meta.env.VITE_APP_NAME || 'Laravel';

const app1 = createApp({});
app1.component('menu', Menu);
app1.mount("#app1");

createInertiaApp({
    title: (title) => `${title} - ${appName}`,
    resolve: (name) => resolvePageComponent(`./Pages/${name}.vue`, import.meta.glob('./Pages/**/*.vue')),
    setup({ el, App, props, plugin }) {
        return createApp({ render: () => h(App, props) })
            .use(plugin)
            .use(ZiggyVue)
            .mount(el);
    },
    progress: {
        color: '#4B5563',
    },
});

app.blade.php

 <body class="font-sans antialiased">
        <div class="min-h-screen mx-auto bg-gray-100 dark:bg-gray-900">
        <div id="app1">
        <menu></menu> <!-- Your Vue component -->
    </div>
            <!-- Page Content -->
            <main>
                @yield('content')
            </main>
        </div>
    </body>

I want menu should be rendered on all pages where app.blade(layout file) is be extended

0 likes
2 replies
jlrdw's avatar

Check this line:

import Menu from '@/Components/AppMenu.vue';

Should it be:

import Menu from './Components/AppMenu.vue';

Please or to participate in this conversation.