Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save ibrahimtuzlak0295/3beb2b04da82c53888eed8e465876263 to your computer and use it in GitHub Desktop.

Select an option

Save ibrahimtuzlak0295/3beb2b04da82c53888eed8e465876263 to your computer and use it in GitHub Desktop.
Laravel-Inertia & Vue 3 - Persistent Layout

pLayout.js

import BaseLayout from "@/Layouts/BaseLayout.vue"; // Should contain `<slot>`

export const pLayout = (title) => {
    return (h, page) => h(BaseLayout, { title }, () => page);
};

Usage:

import {pLayout} from '@/Utils/pLayoutUtil';
// ...
defineOptions({
    layout: pLayout('Dashboard'),
});

With this, the Inertia/Vue routing will not cause full re-render of the page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment