mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-02-05 06:38:00 +01:00
fix(usePortal): adjust portal target resolution logic (#3954)
This commit is contained in:
committed by
GitHub
parent
50863635d6
commit
db11db6ff1
@@ -6,11 +6,11 @@ export function usePortal(portal: Ref<string | HTMLElement | boolean | undefined
|
|||||||
const portalTarget = inject(portalTargetInjectionKey, undefined)
|
const portalTarget = inject(portalTargetInjectionKey, undefined)
|
||||||
|
|
||||||
const to = computed(() => {
|
const to = computed(() => {
|
||||||
if (typeof portal.value === 'string' || portal.value instanceof HTMLElement) {
|
if (typeof portal.value === 'boolean' || portal.value === undefined) {
|
||||||
return portal.value
|
return portalTarget?.value ?? 'body'
|
||||||
}
|
}
|
||||||
|
|
||||||
return portalTarget?.value ?? 'body'
|
return portal.value
|
||||||
})
|
})
|
||||||
|
|
||||||
const disabled = computed(() => typeof portal.value === 'boolean' ? !portal.value : false)
|
const disabled = computed(() => typeof portal.value === 'boolean' ? !portal.value : false)
|
||||||
|
|||||||
Reference in New Issue
Block a user