VUE (two) instructions VUE

1. v-prev (use less)

Will not 'a' rendering, displaying the text

       

2.v-cloak (to reduce the impact of flash, optimize the user experience)

3.v-once do not want to change the value to get an array is always the first to get the

4.v-html === innerHTML

5.v-text === innerText (v-text is not used)

     

Similarly adding the div {} {}, but v-text content added any intermediate div tag will not be rendered

      

6. v-if

flag is true div existed, does not exist is false

div tags can be replaced with an empty, because it is meaningless, just want to judge, can be reduced with an empty tag dom added efficiency performance

7.v-else

There can not pay attention to other elements between v-if and v-else

8. v-else-if

9. v-show display does not show false to true

The difference between v-show, v-if's

1、

When the v-show does not show element is present, but the style is the display: none

v-if not is displayed when the element does not exist, it is removed, and then inserted into the display

2, in the template in v-show does not take effect

10.v-bind: bind attribute is shorthand for:

Binding two class values ​​need to use an array

Binding two class, show only a first class of binding (color is yellow green)

 

Binding style to be written in the form of an object

 

11.v-on shorthand @

Switching Color:

12.v-for circulation

key value must be unique

In addition to loop through the array can traverse the object

(key,value) in person 对象

(Item, index) in personArr array can be distinguished

You can traverse the numbers:

<div v-for="item in 8">{{ item }}</div>

Traversal string:

<div v-for="item in 'duyi'">{{ item }}</div>

 

key value can not give template, give the real elements

 

Guess you like

Origin www.cnblogs.com/tianya-guoke/p/11444342.html