Skip to content

useTeleport

Cross-platform teleport abstraction hook. Bridges Vue <Teleport> (H5) and position: fixed (mini-programs/App).

Usage

ts
import { useTeleport } from 'see-u-ui'

const { isTeleported, targetSelector, isSupported } = useTeleport()
// H5: isTeleported=true, targetSelector='body'
// MP: isTeleported=false, fallback to fixed positioning

API

useTeleport(options?)

ParamTypeDefaultDescription
options.isEnabledMaybeRef<boolean>trueEnable teleport
options.tostring'body'Target selector

Returns:

PropertyTypeDescription
isTeleportedComputedRef<boolean>Should use teleport
targetSelectorComputedRef<string>Target selector
isSupportedbooleanPlatform supports native Teleport

Liao ICP No. 2025070134