(
vnode,
container,
anchor,
moveType,
parentSuspense = null,
)
| 2046 | } |
| 2047 | |
| 2048 | const move: MoveFn = ( |
| 2049 | vnode, |
| 2050 | container, |
| 2051 | anchor, |
| 2052 | moveType, |
| 2053 | parentSuspense = null, |
| 2054 | ) => { |
| 2055 | const { el, type, transition, children, shapeFlag } = vnode |
| 2056 | if (shapeFlag & ShapeFlags.COMPONENT) { |
| 2057 | move(vnode.component!.subTree, container, anchor, moveType) |
| 2058 | return |
| 2059 | } |
| 2060 | |
| 2061 | if (__FEATURE_SUSPENSE__ && shapeFlag & ShapeFlags.SUSPENSE) { |
| 2062 | vnode.suspense!.move(container, anchor, moveType) |
| 2063 | return |
| 2064 | } |
| 2065 | |
| 2066 | if (shapeFlag & ShapeFlags.TELEPORT) { |
| 2067 | ;(type as typeof TeleportImpl).move(vnode, container, anchor, internals) |
| 2068 | return |
| 2069 | } |
| 2070 | |
| 2071 | if (type === Fragment) { |
| 2072 | hostInsert(el!, container, anchor) |
| 2073 | for (let i = 0; i < (children as VNode[]).length; i++) { |
| 2074 | move((children as VNode[])[i], container, anchor, moveType) |
| 2075 | } |
| 2076 | hostInsert(vnode.anchor!, container, anchor) |
| 2077 | return |
| 2078 | } |
| 2079 | |
| 2080 | if (type === Static) { |
| 2081 | moveStaticNode(vnode, container, anchor) |
| 2082 | return |
| 2083 | } |
| 2084 | |
| 2085 | // single nodes |
| 2086 | const needTransition = |
| 2087 | moveType !== MoveType.REORDER && |
| 2088 | shapeFlag & ShapeFlags.ELEMENT && |
| 2089 | transition |
| 2090 | if (needTransition) { |
| 2091 | if (moveType === MoveType.ENTER) { |
| 2092 | // #14031 if there is no pending v-show leave, the persisted |
| 2093 | // transition lifecycle is directive-owned, so activating a kept-alive |
| 2094 | // node only relocates it. |
| 2095 | if (transition!.persisted && !el![leaveCbKey]) { |
| 2096 | hostInsert(el!, container, anchor) |
| 2097 | } else { |
| 2098 | transition!.beforeEnter(el!) |
| 2099 | hostInsert(el!, container, anchor) |
| 2100 | queuePostRenderEffect(() => transition!.enter(el!), parentSuspense) |
| 2101 | } |
| 2102 | } else { |
| 2103 | const { leave, delayLeave, afterLeave } = transition! |
| 2104 | const remove = () => { |
| 2105 | if (vnode.ctx!.isUnmounted) { |
no test coverage detected