Vue.js syntax and common instruction __js

Source: Internet
Author: User

If you're used to using jquery to manipulate the DOM, you can learn to vue.js with the idea of manually manipulating the DOM, because Vue.js is data-driven and requires no manual manipulation of the DOM. It binds the DOM and the data with some special HTML syntax. Once you create a binding, the DOM is synchronized with the data, and the DOM is updated accordingly whenever the data is changed.

Of course, when using vue.js, you can also use it in conjunction with other libraries, such as jquery.

1. Use

The process of using Vue is the process of defining the various components of MVVM (Model-view-viewmodel).

2, vue.js of common instructions

Vue.js provides some common built-in instructions, and then we'll introduce a few of the following built-in directives:

v-if instruction v-show instruction v-else instruction v-for instruction v-bind instruction v-on directive

Vue.js has a good extensibility, we can also develop some custom directives, and later articles will introduce custom directives.

2.1 V-if Instruction

V-if An expression that can be converted to a Boolean type

2.2 V-show

2.3 V-else Instruction

2.4 V-for Instruction

2.5 v-bind Instruction

The v-bind instruction can be preceded by an argument with a colon separated by its name, which is usually an attribute of an HTML element

2.6 v-on Command 8

2.7 V-model Instruction

V-model create a two-way data binding on a form control element



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.