#3179 fix v-model on component value always casted to string
various other internal stability fixes
重要更新:
Custom directive change:
update hook will now always be called when the component is updated. This makes the lifecycle more consistent with the new rendering model. The user can simply check forbinding.value !== binding.oldValue to persist the old behavior, or always perform the update (e.g. when the directive is bound to an object that might be mutated instead of replaced).
Transition hooks naming change (now same with 1.x):
onEnter -> enter
onLeave -> leave
Server-side rendering:
The component-level caching option server.getCacheKey is renamed to serverCacheKey(no longer necessary to nest under the server block):
export default {
// ...
serverCacheKey: props => props.item.id
}
createRenderer and createBundleRenderer no longer uses lru-cache as the default cache implementation. The user is now responsible for providing the cache implementation which should adhere to the following interface:
{
get: (key: string, [cb: Function]) => string | void,
Functional component render function signature change:
The first argument is still h which is $createElement bound to the parent instance. Everything else is now passed in the second argument which is a context object:
export default {
functional: true,
render (h, context) {
// extracted and validated props for the functional component itself
context.props
// raw data for the functional component's vnode
// without extracted props
context.data
// **a function** that returns the child elements
// nested inside the functional component's tag
context.children
// the parent component instance
context.parent
}
}
This avoids having to remember the argument order and makes it easier when you only need some of the arguments:
export default {
functional: true,