Practical use of VueJS with Laravel Practical use of VueJS with Laravel laravel laravel

Practical use of VueJS with Laravel


moved from comment

Why do we even need to use Vue with Laravel.

Although you probably already knew, Vue is just one of many javascript frontend frameworks (libs?) You can consume the data send from the server any way you want. Vue is just the sister-framework of Laravel. The only thing you can probably say as to why they are mentioned together is that you can "talk" (interface) easily between them using json objects. Javascript is meant to make your page interactive, have behaviour. Use it when you need this.

Laravel and Vue both have their own routing system. Which one to use?

Whatever you want, do you want a "single page" (blade) that is rendered in 3 different pages by Vue, say like some kind of Wizard form. It really depends on where you want to put the load. I think you can think of use-cases where client side page rendering would be better, but most of the time server sided will be a great choice.

Single page applications are more snappy (faster) after initial load, but server side rendered applications are better for SEO in general. There are also ways to let a SPA render on the server to improve SEO however. And this we we can keep the discussion going for some while.

How to structure an app using Laravel + Vue

Laravel has already an example vue file under resources/assets/js/app.js. So it is safe to assume you can put everything there.