M
M
mesc2018-07-26 08:48:16
Vue.js
mesc, 2018-07-26 08:48:16

How to properly use vue in laravel?

Good afternoon!
I have been working with Lara for a long time, but I started working with vue recently and I just can’t figure out how to most competently implement some functionality:
1) There is a basic user management functionality - displaying a list of users, editing, adding and deleting. All this works, but I use 3 templates (single-file) to implement this functionality, say usersIndex.vue, usersEdit.vue and usersAdd.vue. Then, when increasing this functionality (the ability to edit rights, for example), I will have to create N more templates. Is this how it should be, or have I misunderstood and is it somehow possible to use the option with creating a smaller number of templates?
2) There is an information block in the header of the site. In the admin panel, you can enable or disable its display. How can I pass the state of this block so that vue will connect (or not connect) it to the template?
3) Is it necessary (is it worth it) to separate the API for the web interface and the API for mobile devices?
Sorry for the possibly simplistic questions. There is so much information on points 1 and 3 on the Internet that it is difficult for me, as a non-specialist in this field, to decide.
Thanks in advance to everyone for the replies.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Filippenko, 2018-07-26
@mesc

1. Add and Edit are usually combined. Basically, it's the same form. And maybe some small components can be reused. But you're right, there will be a lot of them, that's fine. Organize in folders)
2. In the general template in mounted or created, you need to send a request and find out if it is enabled. Further, when connecting the corresponding component, use v-if
3. But why? Do they differ significantly in functionality?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question