@bitrix24/b24ui-nuxt
Version:
Bitrix24 UI-Kit for developing web applications REST API for NUXT & VUE
13 lines (12 loc) • 571 B
JavaScript
import { inject, computed } from "vue";
export const portalTargetInjectionKey = Symbol("bitrix24-ui.portal-target");
export function usePortal(portal) {
const globalPortal = inject(portalTargetInjectionKey, void 0);
const value = computed(() => portal.value === true ? globalPortal?.value : portal.value);
const disabled = computed(() => typeof value.value === "boolean" ? !value.value : false);
const to = computed(() => typeof value.value === "boolean" ? "body" : value.value);
return computed(() => ({
to: to.value,
disabled: disabled.value
}));
}