Releases: vuejs/vue
v2.0.0-alpha.5
New
-
The
render
function now receives the component instance's$createElement
method as its only argument. This avoids having to aliasingthis.$createElement
to something less verbose:Vue.extend({ render (h) { return h('div', null, 'hello!') } })
-
Functional components:
A component can be defined as a stateless functional component with
functional: true
.- A functional component has no instance and is simply a function that receives props and children vnodes via arguments, and also return vnode(s).
- Unlike stateful components, functional components are not restricted by the "single root node" rule and can return an Array of multiple vnodes.
- A functional component's render function receives the following arguments:
createElement
: the parent component's$createElement
method.props
: an object containing propschildren
: children inside the component's tag as vnodes
Example usage:
Vue.component('wrap-with-tag', { functional: true, props: ['tag'], render (h, props, children) { return h(props.tag, null, children) } })
When used in template:
<wrap-with-tag tag="div">hello</wrap-with-tag>
Will render:
<div>hello</div>
Breaking Changes
-
v-ref
is now no longer a directive: it is now a special attribute similar tokey
andtransition
:<!-- before --> <comp v-ref:foo></comp> <!-- after --> <comp ref="foo"></comp>
Dynamic ref bindings are now also supported:
<comp :ref="dynamicRef"></comp>
-
The
<render>
tag is removed in favor of stateless functional components. -
It is now prohibited to replace a component instance's root
$data
. This prevents some edge cases in the reactivity system and makes the component state more predictable (especially with type-checking systems).
v2.0.0-alpha.4
New
Vue.config.ignoredElements
: an Array of element tag names to ignore during render. Elements listed in this option will be rendered as plain elements instead of components.
Fixed
- Wrong
v-for
alias check regex in template compilation error detection
v1.0.25
New
mixins
option can now use constructors returned byVue.extend
in addition to plain objects. (@ktsn)
Fixed
- fix unknown element warning for
<details>
etc in Firefox - #2890 fix
json
filter with 0 indent (@posva) - #2983 fix v-model select initial value edge cases in IE
- #2988 fix falsy value output for one time text bindings (@dsonet)
- #2993 fix comment inside
<template>
being treated as string (@simplesmiler) - #3027 fix MutationObserver-related issues in iOS 9.3 UIWebView (@miccycn)
- #3039 fix component local name option being overwritten by global registration (@kazupon)
- #3062 fix multi-line expression inside HTML interpolation
v2.0.0-alpha.3
Breaking Changes
- When used with
vue-loader
orvueify
for the scoped CSS feature, content inserted via<slot>
will be affected by scoped styles in both the parent and the child, similar to the root element of the child component. This allows the child component to apply scoped styles to inserted content, although this also means the child component needs to be more careful about its selectors.
Fixed
- Improved template error detection (fixed a number of false alarms)
- Properly HTML-encode text in server-side rendering.
- Properly support scoped CSS attributes in server-side rendering.
v2.0.0-alpha.2
Breaking Changes
v-for
iteration syntax change: see #3073
Fixed
- Fixed nested
<template>
handling in single-file component parser - #3054 components not correctly copying static render functions from options (@simplesmiler)
v2.0.0-alpha.1
This is the first release of 2.0.
- Recommended for: experiments, prototypes, upgrading small, non-critical 1.x apps
- NOT recommended for: production use, upgrading production 1.x apps
Documentation still needs to be worked on. In the meanwhile for changes from 1.x and upgrade information, please refer to this thread.
There is also a recorded video of the livestream session that went through some of the major changes in 2.0.
Installation
- Built files
- From npm:
npm install vue@next
v1.0.24
v1.0.23
v1.0.22
New
- new option:
propsData
. This option allows you to pass props to an instance created imperatively withnew
without having to wrap it in a parent instance. This is primarily intended to make unit testing easier. docs - new option:
extends
. Allows declaratively extending another component (could be either a plain options object or a constructor) without having to useVue.extend
. This is primarily intended to make it easier to extend between single file components. (@pespantelis) docs - #2676 Added support for decimal places in currency filter (@phanan) docs
Fixed
- #2642 reserve non-resolved
is
attribute for native custom elements - #2659 exclude
.capture
fromv-on
key filters (@eric6356) - #2663 fix handling v-if along with v-for on a template tag (@simplesmiler)
- #2666 remove
:is
attribute even when component is cached (@GuillaumeLeclerc) - #2670 ensure dynamic method resolution for component inline v-on
- #2674 fix async update in WeChat browser (@duanjun)
- #2686 fix deep watch on objects with circular references (@flytreeleft)
- #2687 fix
data
function being called twice (@blake-newman) - #2707 fix modifiers being incorrectly passed to terminal directives (@blake-newman)
- #2723 default slot should use fallback content if it has only whitespace
- #2731 fix
Vue.delete
when used on a Vue instance (@Jinjiang) - #2745 handle v-for anchor position when moved by external lib
- #2750 ensure correct watcher invocation order for changes triggered inside user watchers
- #2773 fix
v-model
cursor position by only setting value property when value is changed (@zigomir) - #2789 do not merge empty class on component placeholder
- #2805 treat template tags as string templates to workaround iOS Safari 9 crash bug
- #2808
v-bind:class
multiple class names support for array syntax
v1.0.21
New
-
Component prop type can now be an array of types (@ealves-pt):
props: { myProp: [String, Number] // can either be a string or a number }
-
Most of the warnings now come with the name of the component it is found in (if a name is available).
-
Runtime warnings now use
console.error
, which means they come with stack traces by default. SettingVue.config.debug = true
now only enables comment anchor nodes. -
orderBy
filter improvements (@posva)The
orderBy
array filter can now accept:- multiple sort keys, or
- an array of sort keys, or
- a custom comparator function (same with the comparator used in
Array.prototype.sort
)
See updated docs for examples.
-
:class
bindings now support using a string of multiple classes (@phanan):<div :class="{ 'a b c': true }"></div>
-
track-by
forv-for
can now accept a path instead of a simple key.
Fixed
- #2567 fix IE9 inline style bindings that need vendor prefix
- #2573 ensure
v-if
andv-for
compilation order is not dependent on appearance order. (v-for
always comes first) - #2580 initially invalid props should still be reactive
- #2593 fix explicitly setting
Vue.config.devtools
to non-default value - #2606 prop coercion should be applied to default values (@simplesmiler)
- #2620 text parser should not remove newlines, also fix cache hit (@sirlancelot)