1.0.0-rc.2
The corresponding migration build for this release is 1.0.0-rc.2-migration.
New
-
v-fornow support thev-for="(key, val) in obj"orv-for="(index, val) in arr"syntax. This allows nested loops to more easily reference the key or index. -
v-oncan now omit the expression if it has modifiers. e.g.@submit.preventwill callpreventDefault()onsubmitevents. -
Custom directive API improvement:
Custom directives can now provide a
paramsArray, and the Vue compiler will automatically extract these attributes on the element that the directive is bound to. The old undocumentedthis.param()directive instance method has been deprecated.Example:
<div v-example a="hi"></div>
Vue.directive('example', { params: ['a'], bind: function () { console.log(this.params.a) // -> "hi" } })
This API also supports dynamic attributes. The
this.params[key]value is automatically kept up-to-date. In addition, you can specify a callback when the value has changed:<div v-example :a="someValue"></div>
Vue.directive('example', { params: ['a'], paramWatchers: { a: function (val, oldVal) { console.log('a changed!') } } })