Skip to content

Commit db11db6

Browse files
authored
fix(usePortal): adjust portal target resolution logic (#3954)
1 parent 5086363 commit db11db6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/runtime/composables/usePortal.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ export function usePortal(portal: Ref<string | HTMLElement | boolean | undefined
66
const portalTarget = inject(portalTargetInjectionKey, undefined)
77

88
const to = computed(() => {
9-
if (typeof portal.value === 'string' || portal.value instanceof HTMLElement) {
10-
return portal.value
9+
if (typeof portal.value === 'boolean' || portal.value === undefined) {
10+
return portalTarget?.value ?? 'body'
1111
}
1212

13-
return portalTarget?.value ?? 'body'
13+
return portal.value
1414
})
1515

1616
const disabled = computed(() => typeof portal.value === 'boolean' ? !portal.value : false)

0 commit comments

Comments
 (0)