Home  >  Article  >  Web Front-end  >  What is the difference between vue and js

What is the difference between vue and js

coldplay.xixi
coldplay.xixiOriginal
2021-03-16 14:28:4124269browse

The difference between vue and js: 1. js must first obtain the DOM object, and then modify the value of the DOM object; 2. Vue first binds the value to the js object, and then modifies it. js object, the Vue framework will automatically update the DOM value.

What is the difference between vue and js

The operating environment of this tutorial: windows7 system, javascript1.8.5&&Vue2.9.6 version, DELL G3 computer.

The difference between vue and js:

javaScript is a scripting language that runs on the browser side. JavaScript mainly solves the problem of interaction between the front end and the user. , including the use of interaction and data interaction, JavaScript is interpreted and executed by the browser.

Vue.js can be used as a js library, or you can use its full set of tools to build system interfaces. These can be flexibly selected according to the needs of the project, so Vue.js It is a progressive JavaScript framework for building user interfaces. Vue's core library only focuses on the view layer. Vue's goal is to implement response data binding through the simplest possible API. At this point, Vue.js is similar to the background template language. It is essentially js code

Example:

javaScript gets the tag element:

<script>
var h1 = document.getElementById("title")
var h2 = document.getElementsByTagName("h1");
console.log(h1.innerHTML)
h1.innerHTML=&#39;修改后的标题&#39;
</script>

Vue gets the tag element:

var vm = new Vue({
    el:"#box1",
    data:{
        content:"标题"
    },
    methods:{
        dianji1:function () {
             this.content = "修改后的标题"
        }
    }
})

Summary:

  • js must first obtain the DOM object, and then modify the value of the DOM object.

  • Vue first compares the value with the js object Bind and then modify the value of the js object, the Vue framework will automatically update the DOM value.

Related free learning recommendations: javascript video tutorial

The above is the detailed content of What is the difference between vue and js. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn