Answer the question
In order to leave comments, you need to log in
How easy is it to migrate from jQuery to VUE?
The question follows from the previous question about the relevance of js frameworks -
Javascript frameworks - a tribute to fashion or speed and...
Judging by the answers, js frameworks are convenient, fast, nothing more - it's cooler than jquey !
-------------------------------------------------- -------------------------------------------------
Let's take one cf. a statistical page, for example a simple landing page , which consists of:
active
Answer the question
In order to leave comments, you need to log in
Specifically, it is easier here, and I would even say, you need to make a page on jquery =))
------------------------
If you are interested in how to basically replace jquery to vue, I will try to answer.
1. As in the case of jquery, we are looking for a suitable package. For example this one .
2. The accordion is realized by hand with a couple of lines
<div>
<h2 @click="toggle"></h2>
<div v-if="stateOpen">
Скрытое содержимое
</div>
</div>
{
data() {
return {
stateOpen: false,
}
},
methods: {
toggle(){
this.stateOpen = !this.stateOpen;
}
}
}
It seems to me that frameworks are suitable for more complex applications than landing pages. In a large application, there are many components that are often used in several places, there is routing and many other goodies. If this is a one-page landing, I would not shove any framework there. I just don't see the point
No, it is, of course, absolutely possible to do this on Vue, without including all sorts of jQ ... just why the heck? You understand the whole essence of frameworks when you do SPA / you access the server a lot / ... Why is this on the landing page? Here you need to write 200 lines of code.
You made the right conclusion about frameworks, but you won't get that far. Open office. Vue site, read the info about it. And it’s better to go through some tutorial , then you will be much better at imagining the frameworks.
IMHO, the best tutorial for a beginner is from React . It's easy, takes 3 hours.
The official documentation is quite simple and clear. For a simple landing, it probably makes no sense to drag a framework. Except for educational purposes. The benefit of the framework becomes noticeable if you need to reuse components in different places. Or some more complex logic appears on the page. For example, a visual designer of the desired product or something like that. In a landing page, it makes little sense to split the page into a bunch of components like Header , Footer , which will be used once. They can simply be folded into different files if you want to structure the project a little and glue the whole page together during the assembly process. If there are a lot of components (for example, some products), then you can already think about the components.
In general, you can learn from any project. In the process, you will understand the limits of applicability of the framework, etc.
For example, after reading this wonderful article https://www.smashingmagazine.com/2018/02/jquery-vu...
Specifically, in the example you listed, there is absolutely nothing complicated and I don’t see the need to use any framework at all. Everything can be easily solved with vanilla js, part of it is generally pure CSS.
Perhaps the only exception is if the budget is more than modest, the deadlines are short, you just have to do it and forget it. Then it can be savings.
As far as frameworks in general, and jQuery as well, keep in mind that the size numbers for these "gzipped and minified" libraries are very misleading. They only affect the download speed of these scripts, and this can even be neglected. Even more so when using the HTTP/2 protocol. The problem with them starts later - when the browser unzips them and starts parsing them. This is where a significant waste of time occurs, which slows down the rendering of the page. The same jQuery last unpacked - almost 260Kb of code that needs to be parsed and executed. This is very resource intensive.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question