element-plus
Version:
A Component Library for Vue 3
49 lines (46 loc) • 1.54 kB
JavaScript
import { defineComponent, ref, computed, openBlock, createBlock, Teleport as Teleport$1, createElementVNode, normalizeClass, normalizeStyle, renderSlot, createCommentVNode } from 'vue';
import '../../../hooks/index.mjs';
import { elTeleportProps } from './teleport.mjs';
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
const _sfc_main = defineComponent({
props: elTeleportProps,
setup(props) {
const ns = useNamespace("teleport");
const containerRef = ref();
const containerStyle = computed(() => {
return props.container === "body" ? [
props.style,
{
position: "absolute",
top: `0px`,
left: `0px`,
zIndex: props.zIndex
}
] : {};
});
return {
ns,
containerRef,
containerStyle
};
}
});
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return _ctx.container ? (openBlock(), createBlock(Teleport$1, {
key: 0,
to: _ctx.container,
disabled: _ctx.disabled
}, [
createElementVNode("div", {
ref: "containerRef",
class: normalizeClass(_ctx.ns.b()),
style: normalizeStyle(_ctx.containerStyle)
}, [
renderSlot(_ctx.$slots, "default")
], 6)
], 8, ["to", "disabled"])) : createCommentVNode("v-if", true);
}
var Teleport = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
export { Teleport as default };
//# sourceMappingURL=teleport2.mjs.map