|
@@ -86,27 +86,12 @@ export function createPatchFunction (backend) {
|
|
|
|
|
|
|
|
let inPre = 0
|
|
let inPre = 0
|
|
|
function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) {
|
|
function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) {
|
|
|
- let i, isReactivated
|
|
|
|
|
- const data = vnode.data
|
|
|
|
|
- vnode.isRootInsert = !nested
|
|
|
|
|
- if (isDef(data)) {
|
|
|
|
|
- if (isDef(i = data.hook) && isDef(i = i.init)) {
|
|
|
|
|
- isReactivated = i(vnode, false /* hydrating */, parentElm, refElm)
|
|
|
|
|
- }
|
|
|
|
|
- // after calling the init hook, if the vnode is a child component
|
|
|
|
|
- // it should've created a child instance and mounted it. the child
|
|
|
|
|
- // component also has set the placeholder vnode's elm.
|
|
|
|
|
- // in that case we can just return the element and be done.
|
|
|
|
|
- if (isDef(i = vnode.child)) {
|
|
|
|
|
- initComponent(vnode, insertedVnodeQueue)
|
|
|
|
|
- if (isReactivated) {
|
|
|
|
|
- // unlike a newly created component,
|
|
|
|
|
- // a reactivated keep-alive component doesn't insert itself
|
|
|
|
|
- insert(parentElm, vnode.child.$el, refElm)
|
|
|
|
|
- }
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ vnode.isRootInsert = !nested // for transition enter check
|
|
|
|
|
+ if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
|
|
|
|
|
+ return
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ const data = vnode.data
|
|
|
const children = vnode.children
|
|
const children = vnode.children
|
|
|
const tag = vnode.tag
|
|
const tag = vnode.tag
|
|
|
if (isDef(tag)) {
|
|
if (isDef(tag)) {
|
|
@@ -172,6 +157,29 @@ export function createPatchFunction (backend) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
|
|
|
|
|
+ let i = vnode.data
|
|
|
|
|
+ if (isDef(i)) {
|
|
|
|
|
+ const isReactivated = isDef(vnode.child) && i.keepAlive
|
|
|
|
|
+ if (isDef(i = i.hook) && isDef(i = i.init)) {
|
|
|
|
|
+ i(vnode, false /* hydrating */, parentElm, refElm)
|
|
|
|
|
+ }
|
|
|
|
|
+ // after calling the init hook, if the vnode is a child component
|
|
|
|
|
+ // it should've created a child instance and mounted it. the child
|
|
|
|
|
+ // component also has set the placeholder vnode's elm.
|
|
|
|
|
+ // in that case we can just return the element and be done.
|
|
|
|
|
+ if (isDef(vnode.child)) {
|
|
|
|
|
+ initComponent(vnode, insertedVnodeQueue)
|
|
|
|
|
+ if (isReactivated) {
|
|
|
|
|
+ // unlike a newly created component,
|
|
|
|
|
+ // a reactivated keep-alive component doesn't insert itself
|
|
|
|
|
+ insert(parentElm, vnode.elm, refElm)
|
|
|
|
|
+ }
|
|
|
|
|
+ return true
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
function insert (parent, elm, ref) {
|
|
function insert (parent, elm, ref) {
|
|
|
if (parent) {
|
|
if (parent) {
|
|
|
nodeOps.insertBefore(parent, elm, ref)
|
|
nodeOps.insertBefore(parent, elm, ref)
|