changes.md 1.4 KB

Instantiation

Instances are no longer compiled at instantiation. Data will be observed, but no DOM compilation will happen until the new instance method $mount has been called. Also, when a new instance is created without el option, it no longers auto creates one.

var vm = new Vue({ data: {a:1} }) // only observes the data
vm.$mount('#app') // actually compile the DOM

More flexible directive syntax

  • v-on

    <a v-on=”{click: onClick, dragmove: onMove}”></a>
    
  • v-style

    <a v-style=”{top: list + ‘px’}”></a>
    
  • custom directive

    <a v-my-table=”{ data:hello, rows:5, cols:10 }”>fsef</a>
    
  • v-repeat

    <ul>
      <li v-repeat="{
        data     : list,
        as       : 'item',
        filterBy : filterKey,
        orderBy  : orderKey
      }"></li>
    </ul>
    

Two Way filters

  <input v-model="abc | email">
Vue.filter('format', {
  read: function (val) {
    return val + '!'
  },
  write: function (val, oldVal) {
    return val.match(/ok/) ? val : oldVal
  }
})

(Experimental) Validators

  <input v-model="abc @ email">
  Vue.validator('email', function (val) {
    return val.match(...)
  })
  // this.$validation.abc // false
  // this.$valid // false

(Experimental) One time interpolations

<span>{{* hello }}</span>