fix(teleport): do not throw target warning when teleport is disabled (#9818)

This commit is contained in:
Yi Yang 2024-05-30 10:51:30 +08:00 committed by GitHub
parent cdb1d1795d
commit 15ee43f66a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 8 deletions

View File

@ -47,14 +47,13 @@ const resolveTarget = <T = RendererElement>(
return null return null
} else { } else {
const target = select(targetSelector) const target = select(targetSelector)
if (!target) { if (__DEV__ && !target && !isTeleportDisabled(props)) {
__DEV__ && warn(
warn( `Failed to locate Teleport target with selector "${targetSelector}". ` +
`Failed to locate Teleport target with selector "${targetSelector}". ` + `Note the target element must exist before the component is mounted - ` +
`Note the target element must exist before the component is mounted - ` + `i.e. the target cannot be rendered by the component itself, and ` +
`i.e. the target cannot be rendered by the component itself, and ` + `ideally should be outside of the entire Vue component tree.`,
`ideally should be outside of the entire Vue component tree.`, )
)
} }
return target as T return target as T
} }