Single Vue Instance vs Multiple instances per page for Laravel
Hey,
I am building a multi-page laravel application and want to start using vuejs for some tweaks and enhancements. I am confused whether to start with multiple instance or single instance at root.
If I use single instance , then will it work on multiple pages ?
You should check out the laracasts series 'Let's Build A Forum with Laravel and TDD'
It was after watching this that I learned why using multiple vue instances is a MISTAKE.
And now I'm stuck with it.
If you have a single app instance, and you register all your components then you never have to worry about whether certain vue instances should be available on which pages.
Which is now my headache.
In short:
1 vue instance.
2 lots of components.
just look at how the default laravel ships with it's components. and an empty vue instance.
The only issue I see with this is with heavy components. I'm aware you import components on demand. Some larger components (for example, an order screen I'm working on) require Vuex and multiple stores. I wouldn't want to load stuff like this on every request.
I know I am replying late on this but I am kind of stuck. Actually I am using laravel and vuejs in a project. I am using vue components within laravel but I have a problem. I want to separate html for admin routes and user routes. Admin will have it own login,dashboard page & the user will have its own profile with different layout. How can I achieve it?