This guide explains how to integrate theDocumentation Index
Fetch the complete documentation index at: https://docs.velure.dev/llms.txt
Use this file to discover all available pages before exploring further.
@robojuice/velure-ui package into an Inertia.js application with Laravel and Vue 3.
Full Code Block
Explanation
1. Imports
bootstrapandapp.css: Initialize JavaScript and CSS assets.VelureVuePlugin: Main plugin from@robojuice/velure-uifor integration.createAppandh: Core Vue 3 APIs to create and render the app.createInertiaApp: Helper function for simplifying Inertia.js app setup.resolvePageComponent: Utility to dynamically load Vue page components.ZiggyVue: Adds Laravel route helpers to the Vue app.pinia: Placeholder for future state management needs.UserResult: Vue component for rendering user-related search results.
2. Application Name
The app name is loaded from theVITE_APP_NAME environment variable, defaulting to "Laravel". It’s used to dynamically set document titles.
3. Creating the Inertia App
createInertiaApp:title: Dynamically sets document titles based on the current page and app name.resolve: Dynamically loads page components usingresolvePageComponent.
4. Setting Up the Application
Thesetup function initializes the Vue app and integrates the necessary plugins:
- Inertia.js Plugin: Enables smooth Inertia navigation.
- ZiggyVue: Adds Laravel route helpers (
route()). - VelureVuePlugin: Configures
velure-uifor: globalSearchQuery: Defines a search handler:- Constructs the API endpoint using Ziggy.
- Fetches search results with
axios. - Sorts results by type and returns the data.
globalSearchComponents: Registers custom components (e.g.,UserResult) for rendering search results.
5. Mounting the App
The app is mounted to the DOM element provided by Inertia.js.6. Progress Indicator
Defines a progress bar with a custom color (#4B5563) to indicate page transitions.
How It Works
- VelureVuePlugin: Adds functionality for global search and component registration.
- Dynamic Page Loading: Pages are loaded on demand using
resolvePageComponent. - Ziggy: Simplifies route definitions within the app.
- Integration: Combines Inertia.js, Laravel, Vue, and
velure-uiinto a cohesive setup.
When to Use
This setup is ideal for integrating@robojuice/velure-ui in a Laravel project using Inertia.js and Vue 3, especially when implementing global search or other Velure-specific features.
Let me know if you have any questions or need further clarification!