I have a Hugo static website that I am making dynamic using Vue. We are transitioning. The long term plan is not yet confirmed but in the intermediate stage we are using Vue.
I already have a Vue app on one page and now I need to implement another page using Vue. So I am thinking that I will make another Vue app for that. Is this acceptable practice or is it against the recommended practice?
First vue app is for submitting a form. Second is for getting and displaying a list of items.
Working with multiple Vue instancesIt is totally legal and fine to have multiple Vue instances on your page controlling different parts and pieces of it. In fact, you can even have your instances communicate with each other by storing them in variables within the global namespace.
This type of application is typically referred to as a Single-Page Application (SPA). Vue provides core libraries and comprehensive tooling support with amazing developer experience for building modern SPAs, including: Client-side router.
Vue. js 3 is a solid framework for building applications both large and small.
Definitely it's acceptable practice.
Vue can be used for single-page apps, but there's nothing wrong in using it in a traditional multiple page-based application. In this context, one Vue app can be one "widget" on such a page, big or small.
The need to have one "central" component will come the moment you'll require sharing data between multiple components. You'll probably get there - but you don't need to worry about it now.
In fact, one of major advantages of Vue is the ease of use in this particular setup. You can introduce it to your codebase step by step, start with a few components, and slowly make your way towards a modern app.
GitLab is known for going through a major progressive rewrite from jQuery to Vue, have a look at their story:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With