I’ve spoken to a number of other developers about using Vue in applications that’s we’re single page applications but just standard MVC applications. Most of the time I get asked, “How would you do that?” So I finally sat down to explain how I do that. I made a video first, because I seem to think better in talking it out with a demo, so you can catch that here.
One of the things I’ve been wanting to talk about for a while are the different ways data can be managed in a Vue application. There’s always lots of discussions on forums about how data is managed and not a lot of diving into why you would pick one style over the other. So I made some videos. I created an application in three different styles, modeled after the three main ways of managing data and data flow in Vue.
There are times when building a Vue application that you realize that the standard parent-child model of intra-component communication just isn’t cutting it anymore. Everything gets too ridged and it gets harder and harder to add more layers to the application. Parent-child just doesn’t scale once you’re really working with a real-world project. Who is in control of the data when the components are nested five layers deep? One way to handle this—coming along with its own pros and cons—is using an Event Bus.
If you’ve used Vue for any length of time, you soon find that it doesn’t have a lot of the fancy formatting options that some of the other frameworks seem to have out of the box. I get the feeling that Vue is very focused on minimalism and adding features that aren’t core to the framework is not something they want to do. One of those features, however, is formatting dates.
One of the best ways to improve the user experience in a dynamic application is by setting up loading icons for data coming into your Vuex store. But if you’ve ever tried to set this up on a page with a lot of components that are loading different dynamic data. How do you show the user that data is being loaded when that data might be coming from different, parallel API calls?
There are times when you want to use Vue components, but the application you’re working on is still in the age of jQuery. Is there a way to start using Vue without switching everything to Vue and making a single page application? Can we get all of that beautiful, juicy component action without breaking everything else that’s currently on the site? Also, can we add Vue components without having to rewrite the entire website to use Vue?
One of the main pieces of advice that people give in learning programming is that you should pick a language and learn it. Just pick the language that you think you’ll most want to do, get a couple of classes or tutorials on it, and learn programming! I think that that’s pretty bad advice. Someone who knows nothing about programming, picking up a language, and trying to learn that language is an extremely inefficient and slow way of learning how to program.