xdesign-vue-next
Version:
XDesign Component for vue-next
38 lines (34 loc) • 1.19 kB
JavaScript
/**
* xdesign v1.0.6
* (c) 2023 xdesign
* @license MIT
*/
import { getSSRAttach, getAttach } from '../utils/dom.mjs';
import { computed, ref, onMounted, watch } from 'vue';
import { i as isFunction_1 } from '../_chunks/dep-1cc1c24f.mjs';
import '../_chunks/dep-10a947a6.mjs';
import '../_chunks/dep-11fa9c2c.mjs';
import '../_chunks/dep-b75d8d74.mjs';
import '../_chunks/dep-82805301.mjs';
import '../_chunks/dep-a95026f2.mjs';
import '../_chunks/dep-068e912d.mjs';
import '../_chunks/dep-addc2a84.mjs';
import '../utils/easing.mjs';
import '../_chunks/dep-6ad18815.mjs';
var useTeleport = function useTeleport(attach, triggerNode) {
var to = isFunction_1(attach) ? computed(attach) : ref(attach);
var innerTriggerNode = isFunction_1(triggerNode) ? computed(triggerNode) : ref(triggerNode);
var element = ref();
var getElement = function getElement() {
element.value = getSSRAttach() || getAttach(to.value, innerTriggerNode.value);
};
onMounted(function () {
return getElement();
});
watch([to, innerTriggerNode], function () {
return getElement();
});
return element;
};
export { useTeleport as default };
//# sourceMappingURL=useTeleport.mjs.map