Ver Fonte

chore: minor tweaks

daiwei há 1 ano atrás
pai
commit
6daa180de9
1 ficheiros alterados com 5 adições e 6 exclusões
  1. 5 6
      packages/runtime-core/src/components/Teleport.ts

+ 5 - 6
packages/runtime-core/src/components/Teleport.ts

@@ -308,12 +308,6 @@ export const TeleportImpl = {
       target,
       props,
     } = vnode
-
-    if (target) {
-      hostRemove(targetStart!)
-      hostRemove(targetAnchor!)
-    }
-
     // an unmounted teleport should always unmount its children whether it's disabled or not
     doRemove && hostRemove(anchor!)
 
@@ -321,6 +315,11 @@ export const TeleportImpl = {
     const disabled = isTeleportDisabled(props)
     if (!disabled && !target) return
 
+    if (target) {
+      hostRemove(targetStart!)
+      hostRemove(targetAnchor!)
+    }
+
     if (shapeFlag & ShapeFlags.ARRAY_CHILDREN) {
       const shouldRemove = doRemove || !disabled
       for (let i = 0; i < (children as VNode[]).length; i++) {