V
V
Vic Shostak2016-11-16 09:20:55
Laravel
Vic Shostak, 2016-11-16 09:20:55

Why use Vue with Laravel?

I figured it out (at the beginner level) with Laravel 5.3, now I want to understand Vue.js and why it was added there.

The essence of the question: what practical application can this js framework have as a frontend for a project on L5.3? Well, besides what Way and Outwell showed on Larakasts ;) Maybe there are some real-life cases (feel, see, learn)?

For example, I read somewhere about the fact that using Vue, you can do without Blade at all (do everything "reactive", through *.vue components).

In short, I will be glad to your comments / links.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
Dmitry Evgrafovich, 2016-11-16
@vikkyshostak

Added so you don't use spaghetti jquery. Vue (like other js frameworks) reduces the amount of code on the client and reduces its complexity.
For example, you are creating an admin panel for a store. You have the following options:
1. Make a static page. There is no logic on the client, everything is calculated by the server. With a new purchase, the administrator will have to refresh the page.
2. Write a dynamic frontend using vue, angular and whatever else. The backend sends you websocket notifications of new orders without reloading the page.
2.1 You take jquery and at first everything goes well. First half hour. Then your code is overgrown with a huge number of event handlers. If the item is out of stock, it must be removed from the table, then if the order is canceled, it must be returned to the table. You returned it, but for some reason the button in the line with it that called the modal window stopped responding to events, then something else happened and something else. The problems with jquery are snowballing and you curse your decision to create a dynamic admin.
2.2 You are using a modern js framework. Vue is good in this regard with a low learning threshold. You load certain objects and, depending on their properties, vue itself builds tables (with sold and unsold goods), hides unnecessary elements (do not show such and such a button if there is only 1 product), sends commands to plugins to update when objects change, and monitors so that the events that fall off with the jquery approach work.
I don’t say that I’m special in javascript, but (that’s why) vuejs on the current project helps me a lot.

O
Oleg, 2016-11-17
@ollisso

It's hard to say why you personally use it :)
How we use it:
1. dynamics on the page, i.e. even a simple "if field A has changed, then change field B" is much easier and faster than with jquery/javascript
2. temlayting. For example, you need to make a convenient template in JS - you can either invent the engine itself. or use ready. Vue is one of them.
3. Display data from the server. Besides, it is possible to generate all html on the server, it is possible on the client. The server has its pros and cons, the client has its own.
VUE convenience - what can be used on individual elements of individual pages. There is no need to completely switch to it for all pages.
See examples here:
https://vuejs.org/v2/examples/hackernews.html

H
he he, 2016-11-16
@tosha_lol_daaa

I won’t answer the question itself, but if I’m not mistaken, then there are a couple of goodies (token generation and something else) on vue, which is why it is included in the kiosk.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question