Vue on the first day of learning

The first day of learning

Vue instruction

  • v-cloak v-text v-html (difference v-text expressions and interpolation).

  • (:) V-bind: Vue bound attribute instruction, the contents of the colon when the analytical expression.

  • (@) V-on:

  • .stop prevent bubbling, i.e., a lower layer of this element does not bubble.

  • .prevent prevent the default event. Example: <a href="http://www.baidu.com">百度</a>Click on this link will jump to the Baidu home page, but with .prevent, the default would not trigger the jump event.

  • .capture achieve capture trigger mechanism, event trigger element from the inside to the outside, as opposed to bubbling mechanism.

  • .self achieved only click on the current element when this element will trigger an event handler.

  • .once only trigger an event handler, click.prevent.once at this time prevent incidents triggered only once, the second time useless

  • The difference .self and .stop: .stop prevents bubbling element layer below the current element, and will only prevent .self have the current element of bubbling, bubbling will not affect the following elements

  • v-model with the form element

  • V-bind the object using the array: class = "{:,:,:}" class name that can also be used without quotation marks, but the property name has - when in quotes

  • In: the style through the array, a plurality of reference pattern data in the object

  • v-for="(item,index) in items"

  • v-for cyclic object: v-for = "(val, key, index) in user" key is required

  • v-for digital loop: v-for = "count in 10"

  • Note: v-for loop, only with v-bind key bindings, and key attribute can only use the number to obtain string, later wrote v-for cycles, write key value

  • When no key, choose the fifth entry, add a front with unshift method, the selected value will change.

  • v-if will be removed when the false elements, and v-show elements will be hidden (display: none), switching performance and consumption initial rendering consumption; v-show cope with frequent switching elements v-if payable may not occur.


Js method

  • .substring (start, stop) to extract the character string intermediary between two specified index, stop may be omitted

  • unshift (newelement1, element2) add one or more elements to the beginning of the array, and returns the new length.


Html method

  • Timer setInterval (code, millisec, lang)

    • code to call a function or code string to be executed.

    • The time between the periodic execution or calling code millisec interval, in milliseconds.

    • lang JScript/VBScript/JavaScript

    (Called multiple times timer time will be superimposed, just call once the timer, then use if do judgment)

  • Clear timer clearInterval (intervalname)


other

  • JS bubbling mechanism: one level coming out. <div><button></button></div>The button in the outer div So will first take the button again to take the div

Guess you like

Origin www.cnblogs.com/goooood/p/11701644.html