Vue.js Introductory Learning (1)-Basic explaining

Source: Internet
Author: User

1. Vue instance-a project is assembled with a lot of vue instances. Each build is an instance of Vue.

var vm = new Vue ()

2. VUE instance life cycle Hooks

Life cycle function: A function that the Vue instance automatically executes at a certain point in time

3, VUE template syntax

{{content}}, v-text= "text", v-html= "code"

4. Calculate attributes, methods and listeners (important)

(1) computed attribute computed has a cache, and the variable does not change.

(2) Listener Watch also has a caching mechanism

Both can be used at the same time. We recommend using computed

5. Getter and setter for calculated attributes

6. Style bindings in Vue

(1): class= "JS expression"

(2): class= "[One,two]"

(3): Style= "Object"

(4): style= "[object,{font-size:12px}]"

7. Conditional rendering in Vue

(1) v-if= "" It doesn't exist.

(2) v-show= "" equivalent to display:none effect

8. List rendering in Vue

(1) v-for= "(item,key,index) of list": key= "Item.id"

(2) Template placeholder, not shown in the foreground, better than div

9. The Set method in Vue

(1) Global method

(2) Example method

(3) Changing the array with the Set method

Vue.set (array name, number of digits, value changed)

VM. $set (array name, number of digits, value changed)

Vue.js Introductory Learning (1)-Basic explaining

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.