[Vuejs]-New Vue() on every Blade or components?

0👍

Well, there is the app.js file in Laravel (and it has been there before Vue was published) and I guess it seems like an obvious choice to bind a Vue instance to an element named app for documentation and teaching purposes, but I never saw that as some kind of standard or even default.

Having a whole web app wrapped inside such an element might even cause trouble because sometimes more than one instance of Vue is required, but Vue instances can’t be nested (without workarounds or when using components).

Also, remember we’re talking about JavaScript, everything happens in the browser and Vue instances on page1.htmland page2.html are separate, even if they inherit some app element from the same Blade template.

So I’d say: Do what suits your (app’s) needs best.

Leave a comment