Vue.js version 2.0

Source: Internet
Author: User

Vue.js version 2.0 upgrade, changed a lot of methods or instructions

New Vue ({     el:' #demo ',     data:{         msg:"vue2.0"      }})
V-model

Lazy number Debounce (obsolete version 2.0) new plus lazy

    • .lazy-Replace input listener change Events
    • .number-input string converted to Digital
    • .trim-Input and trailing space filter

<input v-model.lazy= "msg"/>

V-for
v-forIterative syntax Changes
    • Discard $index and$key

    • New array syntax

      • Value in arr

      • (value, index) in arr

    • New Object Syntax

      • Value in obj

      • (Value, key) in obj

      • (Value, key, index) in obj

Value Key key index index subscript
<li v-for= "Item in Items" >{{item.id}}</li>
<li v-for= "(value,key) in Items" >{{value.id}}--{{key}}</li>
<li v-for= "(value,key,index) in Items" >{{value.id}}--{{key}}--{{index}}</li>

Vue.js version 2.0

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.