"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > VueJS MVVM model compared to Pure HTML

VueJS MVVM model compared to Pure HTML

Published on 2024-08-21
Browse:310

Original article: http://blog.kueiapp.com/programming-tw/vuejs-mvvm-VueJS-MVVM-Model and -Pure-HTML5-Comparison/

The difference between Vue.js and Native HTML5

There are many methods and frameworks to build web front-end systems, such as React, AngularJS, Vue.js, etc. It's absolutely possible to build a system using native HTML5 and JavaScript, but usually using a good framework can implement the system with better design patterns in terms of structure and security.

A tool or architecture is usually created because developers have encountered certain difficulties. For example, jQuery was invented to use JavaScript on browsers that support different standards, and it was the first library to control the DOM (Document Object Modal) using CSS selectors. The HTML5 querySelector replicates this cool feature to make it easier for HTML to manipulate the DOM.

Why you need VueJS

When using Pure HTML5 JavaScript to access the DOM to grab data from the HTML tree, there is a lot of work that needs to be done, such as targeting elements, adding listeners to detect user interactions on the UI, or when the target action is captured Returning data when retrieving it is actually very resource intensive.

  
    

Checkbox with pure HTML5 syntax

VueJS MVVM 模型與 Pure HTML比較

Compared with native HTML5 JavaScript (or jQuery) that directly operates the DOM, Vue.js has its own MVVM model that can modify the DOM while obtaining a new data model. In other words, we can focus on data structure rather than designing our own model to directly manipulate the DOM.

Both approaches are suitable for different situations, but Vue.js actually provides an easier path to building a web frontend.

Using Vue.js

export default Vue.extend({ data: () => ({ checkboxList: [], }), });

example

https://github.com/kueiapp/vue-typescript-tutorial/blob/main/src/App.vue

Original article: http://blog.kueiapp.com/programming-tw/vuejs-mvvm-VueJS-MVVM-Model and -Pure-HTML5-Comparison/

Release Statement This article is reproduced at: https://dev.to/kueiapp/vuejs-mvvm-mo-xing-yu-pure-html5-de-bi-jiao-jig?1 If there is any infringement, please contact [email protected] to delete it
Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3