You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
740 B
23 lines
740 B
11 months ago
|
import { onBeforeMount } from 'vue';
|
||
|
import { isClient } from '@vueuse/core';
|
||
|
import { generateId } from '../../utils/util.mjs';
|
||
|
|
||
|
let cachedContainer;
|
||
|
const POPPER_CONTAINER_ID = `el-popper-container-${generateId()}`;
|
||
|
const POPPER_CONTAINER_SELECTOR = `#${POPPER_CONTAINER_ID}`;
|
||
|
const usePopperContainer = () => {
|
||
|
onBeforeMount(() => {
|
||
|
if (!isClient)
|
||
|
return;
|
||
|
if (process.env.NODE_ENV === "test" || !cachedContainer) {
|
||
|
const container = document.createElement("div");
|
||
|
container.id = POPPER_CONTAINER_ID;
|
||
|
document.body.appendChild(container);
|
||
|
cachedContainer = container;
|
||
|
}
|
||
|
});
|
||
|
};
|
||
|
|
||
|
export { POPPER_CONTAINER_ID, POPPER_CONTAINER_SELECTOR, usePopperContainer };
|
||
|
//# sourceMappingURL=index.mjs.map
|