Browse Source

simplify children updates

dev
Evan You 9 years ago
parent
commit
6d889c0116
  1. 3
      src/core/instance/lifecycle.js
  2. 6
      src/core/instance/render.js
  3. 5
      src/core/vdom/create-component.js

3
src/core/instance/lifecycle.js

@ -81,9 +81,8 @@ export function lifecycleMixin (Vue) {
}
}
Vue.prototype._updateFromParent = function (propsData, listeners, parentVnode, children) {
Vue.prototype._updateFromParent = function (propsData, listeners, parentVnode) {
this.$options._parentVnode = parentVnode
this.$options._renderChildren = children
// update props
if (propsData && this.$options.props) {
observerState.shouldConvert = false

6
src/core/instance/render.js

@ -89,9 +89,9 @@ export function renderMixin (Vue) {
}
}
function resolveSlots (vm, children) {
if (children) {
children = flatten(isArray(children) ? children : children())
function resolveSlots (vm, renderChildren) {
if (renderChildren) {
const children = flatten(renderChildren())
const slots = { default: children }
let i = children.length
let name, child

5
src/core/vdom/create-component.js

@ -83,13 +83,12 @@ function init (vnode) {
}
function prepatch (oldVnode, vnode) {
const { listeners, propsData, children } = vnode.componentOptions
const { listeners, propsData } = vnode.componentOptions
vnode.child = oldVnode.child
vnode.child._updateFromParent(
propsData, // updated props
listeners, // updated listeners
vnode, // new parent vnode
children // new children
vnode // new parent vnode
)
}

Loading…
Cancel
Save