mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 12:14:41 +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 to = computed(() => {
|
||||
if (typeof portal.value === 'string' || portal.value instanceof HTMLElement) {
|
||||
return portal.value
|
||||
if (typeof portal.value === 'boolean' || portal.value === undefined) {
|
||||
return portalTarget?.value ?? 'body'
|
||||
}
|
||||
|
||||
return portalTarget?.value ?? 'body'
|
||||
return portal.value
|
||||
})
|
||||
|
||||
const disabled = computed(() => typeof portal.value === 'boolean' ? !portal.value : false)
|
||||
|
||||
Reference in New Issue
Block a user