]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: minor tweaks
authordaiwei <daiwei521@126.com>
Tue, 14 Jan 2025 01:15:51 +0000 (09:15 +0800)
committerdaiwei <daiwei521@126.com>
Tue, 14 Jan 2025 01:15:51 +0000 (09:15 +0800)
packages/runtime-core/src/components/Teleport.ts

index b402df37b3408649c43e63dd5d496777a6d37e53..7dab240e3ae57327390419d459e18b1e7e66e48d 100644 (file)
@@ -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++) {