A few weeks ago I had a conversation with an interviewer about how we should choose a js framework. He pointed out how exciting it is when major manufacturers start to reveal their exclusive secret recipes. Developer's inner monologue: "The js written by these big companies is different from mine. They are excellent and successful. The way they organize js is better than mine? Do I have to accept it?"
Their secret weapon should be excellent, but don't Assuming its excellence because of other people's passions. You wouldn’t copy and paste an answer from StackOverflow before you understand it, so why would you copy and paste a framework?
This reminds me of when we decided to use vue on GitLab
Made simpler and easier to use
Make The main reason we invested in Vue.js is that it makes it easier for teams to write and use js and simplifies js. Getting started with Vue.js is quite easy. Its source code is highly readable, and if you need to just use its documentation, you can get started. You don't have to use any additional libraries. Can work with jQuery if needed. There are many plugins available, but they are not required. I personally like the elegant Vue.js. It's very easy to use Vue.js with existing code. Vue.js is not mysterious, its bottom layer is just an object.
After discussing with many js developers, I discovered an interesting phenomenon: those developers who spend most of their time on Angular do not have a deep understanding of js. I don't want this to happen to me and my partner. Why do we write "non-js"?
This reminds me of the situation when using Backbone. I need to keep it DRY (don`t repeat yourself) as much as possible, because this thing is a blank piece of paper for you to write on. Vue.js doesn't do much with anything else, it just focuses on data.
But Vue.js strikes a perfect balance between what you have to do and what it can do. If Backbone is anarchy (no one is in charge) then Angular is a dictator (the Angular team is in charge of everything). I feel like Vue.js is like communism: the project is your responsibility, but Vue.js lays out a scalable, robust, and resilient safety net for you to help you program more efficiently and avoid the impact of DOM. .
To let you understand my idea, please see the code click preview
<div id="journal"> <input type="text" v-model="message"> <div>{{message}}</div> </div>
var journal = new Vue({ el: '#journal', data: { message: 'Your first entry' } });
If you have seen some js libraries, it is not difficult to understand the code in the above example without relying on documentation. Often in other frameworks, a brief pause is required here. You feel satisfied when you execute the "entry" level examples. But things get complicated when you want to get value for your money spent on a framework. This doesn't happen with Vue.js, and the practical application is as simple as the documentation example.
Vue.js + GitLab means less code
So what problems does this solve for GitLab? When I joined, all the code was written in JQuery, which was not wrong, but it cost more code to solve every problem. We know we can do better. Once we started using Vue.js, we were able to solve complex problems quickly and continuously using less code.
Let’s give a simple and practical example in the use of our project: In GitLab Issue, the status of the issue is switched between closed and open. This value needs to change frequently and is used in many views. Using JQuery you need about 30 lines of code to implement this function.
In Vue.js, we only need one line of js code. The other code we add is to add some extra attributes to the HTML.
You Yuxi even made a bunker framework and it’s not just about writing excellent code. You need excellent documentation, a strong community that helps everyone in the group learn, support from a supporting library, a large number of plug-ins to help users solve problems, and a feedback loop that is based on user feedback and ensures the relevance of the framework. Vue.js is a combination of all of these, not just great code. That's why I use it, what about you?