Menu

Using Vue in Laravel Without Inertia
πŸ–ΌοΈ

Using Vue in Laravel Without Inertia

DEV CommunityΒ·Rafli ZockyΒ·6 months ago
#88HnQFMV
#vue#php#laravel#javascript#props
Reading 0:00
15s threshold

We can use inertia.js , but sometimes we just need to keep it simple. This also works for React and others.

Folder Structure

# only an example

resources β”œ js β”‚ β”œ app.js β”‚ β”œ App.vue β”‚ β”œ pages β”‚ β”‚ β”” Dashboard.vue β”‚ β”œ components β”‚ β”‚ β”” ui β”‚ β”” layouts β”” views β”” app.blade.php

# Flow

Laravel route ↓ controller returns Blade ↓ Blade sets PAGE + PROPS ↓ Vue loads correct page component ↓ component receives props

Enter fullscreen mode

Exit fullscreen mode

Steps

Installation

# laravel laravel new example-app

# vue npm install vue npm install @vitejs/plugin-vue --save-dev

Enter fullscreen mode

Exit fullscreen mode

Vite

# vite . config .…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.